linux_old1/drivers/char
Zhang, Yanmin b48f5457b4 [PATCH] ipmi: use platform_device_add() instead of platform_device_register() to register device allocated dynamically
I got below warning when running 2.6.19-rc5-mm1 on my ia64 machine.

WARNING at lib/kobject.c:172 kobject_init()

Call Trace:
 [<a0000001000137c0>] show_stack+0x40/0xa0
                                sp=e0000002ff9f7bc0 bsp=e0000002ff9f0d10
 [<a000000100013850>] dump_stack+0x30/0x60
                                sp=e0000002ff9f7d90 bsp=e0000002ff9f0cf8
 [<a000000100407bb0>] kobject_init+0x90/0x160
                                sp=e0000002ff9f7d90 bsp=e0000002ff9f0cd0
 [<a0000001005ae080>] device_initialize+0x40/0x1c0
                                sp=e0000002ff9f7da0 bsp=e0000002ff9f0cb0
 [<a0000001005b88c0>] platform_device_register+0x20/0x60
                                sp=e0000002ff9f7dd0 bsp=e0000002ff9f0c90
 [<a000000100592560>] try_smi_init+0xbc0/0x11e0
                                sp=e0000002ff9f7dd0 bsp=e0000002ff9f0c50
 [<a000000100594900>] init_ipmi_si+0xaa0/0x12e0
                                sp=e0000002ff9f7de0 bsp=e0000002ff9f0bd8
 [<a000000100009910>] init+0x350/0x780
                                sp=e0000002ff9f7e00 bsp=e0000002ff9f0ba8
 [<a000000100011d30>] kernel_thread_helper+0x30/0x60
                                sp=e0000002ff9f7e30 bsp=e0000002ff9f0b80
 [<a0000001000090c0>] start_kernel_thread+0x20/0x40
                                sp=e0000002ff9f7e30 bsp=e0000002ff9f0b80
WARNING at lib/kobject.c:172 kobject_init()

Call Trace:
 [<a0000001000137c0>] show_stack+0x40/0xa0
                                sp=e0000002ff9f7b40 bsp=e0000002ff9f0db0
 [<a000000100013850>] dump_stack+0x30/0x60
                                sp=e0000002ff9f7d10 bsp=e0000002ff9f0d98
 [<a000000100407bb0>] kobject_init+0x90/0x160
                                sp=e0000002ff9f7d10 bsp=e0000002ff9f0d70
 [<a0000001005ae080>] device_initialize+0x40/0x1c0
                                sp=e0000002ff9f7d20 bsp=e0000002ff9f0d50
 [<a0000001005b88c0>] platform_device_register+0x20/0x60
                                sp=e0000002ff9f7d50 bsp=e0000002ff9f0d30
 [<a00000010058ac00>] ipmi_register_smi+0xcc0/0x18e0
                                sp=e0000002ff9f7d50 bsp=e0000002ff9f0c90
 [<a000000100592600>] try_smi_init+0xc60/0x11e0
                                sp=e0000002ff9f7dd0 bsp=e0000002ff9f0c50
 [<a000000100594900>] init_ipmi_si+0xaa0/0x12e0
                                sp=e0000002ff9f7de0 bsp=e0000002ff9f0bd8
 [<a000000100009910>] init+0x350/0x780
                                sp=e0000002ff9f7e00 bsp=e0000002ff9f0ba8
 [<a000000100011d30>] kernel_thread_helper+0x30/0x60
                                sp=e0000002ff9f7e30 bsp=e0000002ff9f0b80
 [<a0000001000090c0>] start_kernel_thread+0x20/0x40
                                sp=e0000002ff9f7e30 bsp=e0000002ff9f0b80

The root cause is the device struct is initialized twice.

If the device is allocated dynamically by platform_device_alloc,
platform_device_alloc will initialize struct device, then,
platform_device_add should be used to register the device.

The difference between platform_device_register and platform_device_add is
platform_device_register will initiate the device while platform_device_add
won't.

Signed-off-by: Zhang Yanmin <yanmin.zhang@intel.com>
Cc: Corey Minyard <minyard@acm.org>
Cc: Greg KH <greg@kroah.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-11-16 11:43:37 -08:00
..
agp Merge master.kernel.org:/pub/scm/linux/kernel/git/davej/agpgart 2006-10-21 13:39:44 -07:00
drm drm: ioremap balanced with iounmap for drivers/char/drm 2006-10-25 09:55:34 -07:00
ftape IRQ: Maintain regs pointer globally rather than passing to IRQ handlers 2006-10-05 15:10:12 +01:00
hw_random Remove all inclusions of <linux/config.h> 2006-10-04 03:38:54 -04:00
ip2 [PATCH] i2Output always takes kernel data now 2006-10-11 11:17:07 -07:00
ipmi [PATCH] ipmi: use platform_device_add() instead of platform_device_register() to register device allocated dynamically 2006-11-16 11:43:37 -08:00
mwave IRQ: Maintain regs pointer globally rather than passing to IRQ handlers 2006-10-05 15:10:12 +01:00
pcmcia IRQ: Maintain regs pointer globally rather than passing to IRQ handlers 2006-10-05 15:10:12 +01:00
rio [PATCH] Char: correct pci_get_device changes 2006-10-21 13:35:05 -07:00
tpm [PATCH] tpm: fix error handling 2006-10-11 11:14:22 -07:00
watchdog [WATCHDOG] sc1200wdt.c pnp unregister fix. 2006-10-29 22:09:32 +01:00
.gitignore [MIPS] Remove IT8172-based platforms, ITE 8172G and Globespan IVR support. 2006-10-03 17:59:17 +01:00
ChangeLog Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
Kconfig [PATCH] mspec driver build fix 2006-11-13 07:40:42 -08:00
Makefile [MIPS] Remove IT8172-based platforms, ITE 8172G and Globespan IVR support. 2006-10-03 17:59:17 +01:00
amiserial.c IRQ: Maintain regs pointer globally rather than passing to IRQ handlers 2006-10-05 15:10:12 +01:00
applicom.c IRQ: Maintain regs pointer globally rather than passing to IRQ handlers 2006-10-05 15:10:12 +01:00
applicom.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
briq_panel.c Remove all inclusions of <linux/config.h> 2006-10-04 03:38:54 -04:00
cd1865.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
consolemap.c Remove obsolete #include <linux/config.h> 2006-06-30 19:25:36 +02:00
cp437.uni Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
cs5535_gpio.c [PATCH] make more file_operation structs static 2006-07-03 15:26:59 -07:00
cyclades.c IRQ: Maintain regs pointer globally rather than passing to IRQ handlers 2006-10-05 15:10:12 +01:00
decserial.c Remove obsolete #include <linux/config.h> 2006-06-30 19:25:36 +02:00
defkeymap.c_shipped Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
defkeymap.map Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
digi.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
digi1.h [PATCH] Clean up the old digi support and rescue it 2005-09-07 16:57:20 -07:00
digiFep1.h [PATCH] Clean up the old digi support and rescue it 2005-09-07 16:57:20 -07:00
digiPCI.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
ds1286.c [PATCH] proper flags type of spin_lock_irqsave() 2006-10-01 00:39:21 -07:00
ds1302.c [PATCH] make more file_operation structs static 2006-07-03 15:26:59 -07:00
ds1620.c [PATCH] make more file_operation structs static 2006-07-03 15:26:59 -07:00
dsp56k.c [PATCH] make more file_operation structs static 2006-07-03 15:26:59 -07:00
dtlk.c [PATCH] make more file_operation structs static 2006-07-03 15:26:59 -07:00
ec3104_keyb.c IRQ: Maintain regs pointer globally rather than passing to IRQ handlers 2006-10-05 15:10:12 +01:00
efirtc.c [PATCH] make more file_operation structs static 2006-07-03 15:26:59 -07:00
epca.c [PATCH] epca: prevent panic on tty_register_driver() failure 2006-10-17 08:18:48 -07:00
epca.h [PATCH] char: kill unneeded memsets 2006-10-04 07:55:13 -07:00
epcaconfig.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
esp.c IRQ: Maintain regs pointer globally rather than passing to IRQ handlers 2006-10-05 15:10:12 +01:00
generic_nvram.c [PATCH] powerpc: Kill _machine and hard-coded platform numbers 2006-03-28 23:15:54 +11:00
generic_serial.c [PATCH] char: kill unneeded memsets 2006-10-04 07:55:13 -07:00
genrtc.c [PATCH] make more file_operation structs static 2006-07-03 15:26:59 -07:00
hangcheck-timer.c IRQ: Maintain regs pointer globally rather than passing to IRQ handlers 2006-10-05 15:10:12 +01:00
hpet.c IRQ: Maintain regs pointer globally rather than passing to IRQ handlers 2006-10-05 15:10:12 +01:00
hvc_console.c IRQ: Maintain regs pointer globally rather than passing to IRQ handlers 2006-10-05 15:10:12 +01:00
hvc_console.h [POWERPC] Make the hvc_console output buffer size settable 2006-07-13 18:53:32 +10:00
hvc_iseries.c Merge branch 'master' of git://oak/home/sfr/kernels/iseries/work 2006-10-04 15:02:27 +10:00
hvc_rtas.c [POWERPC] Make the hvc_console output buffer size settable 2006-07-13 18:53:32 +10:00
hvc_vio.c [POWERPC] The two vio HVC backends clash 2006-09-25 13:30:51 +10:00
hvcs.c IRQ: Maintain regs pointer globally rather than passing to IRQ handlers 2006-10-05 15:10:12 +01:00
hvsi.c IRQ: Maintain regs pointer globally rather than passing to IRQ handlers 2006-10-05 15:10:12 +01:00
i8k.c [PATCH] make more file_operation structs static 2006-07-03 15:26:59 -07:00
ip27-rtc.c [PATCH] make more file_operation structs static 2006-07-03 15:26:59 -07:00
isicom.c [PATCH] Char: isicom, fix close bug 2006-11-14 16:02:02 -08:00
istallion.c [PATCH] trivial iomem annotations: istallion 2006-10-10 15:37:22 -07:00
keyboard.c IRQ: Maintain regs pointer globally rather than passing to IRQ handlers 2006-10-05 15:10:12 +01:00
lcd.c [PATCH] make more file_operation structs static 2006-07-03 15:26:59 -07:00
lcd.h Resurrect Cobalt support for 2.6. 2005-10-29 19:30:42 +01:00
lp.c [PATCH] There is no devfs, there has never been a devfs, we have always been at war with... 2006-09-29 09:18:10 -07:00
mbcs.c IRQ: Maintain regs pointer globally rather than passing to IRQ handlers 2006-10-05 15:10:12 +01:00
mbcs.h [PATCH] mbcs trivial user annotations 2005-05-04 07:33:13 -07:00
mem.c Include proper header file for PFN_DOWN() 2006-10-13 08:42:10 -07:00
misc.c [PATCH] make more file_operation structs static 2006-07-03 15:26:59 -07:00
mmtimer.c IRQ: Maintain regs pointer globally rather than passing to IRQ handlers 2006-10-05 15:10:12 +01:00
moxa.c [PATCH] Char: correct pci_get_device changes 2006-10-21 13:35:05 -07:00
mspec.c [PATCH] mspec driver build fix 2006-11-13 07:40:42 -08:00
mxser.c IRQ: Maintain regs pointer globally rather than passing to IRQ handlers 2006-10-05 15:10:12 +01:00
mxser.h [PATCH] Typo fixes 2006-03-28 09:16:08 -08:00
n_hdlc.c Remove obsolete #include <linux/config.h> 2006-06-30 19:25:36 +02:00
n_r3964.c [PATCH] R3964: fix GFP_KERNEL allocations in timer function 2006-06-25 10:01:17 -07:00
n_tty.c [PATCH] remove TTY_DONT_FLIP 2006-06-28 14:59:05 -07:00
nsc_gpio.c Remove all inclusions of <linux/config.h> 2006-10-04 03:38:54 -04:00
nvram.c [PATCH] make more file_operation structs static 2006-07-03 15:26:59 -07:00
nwbutton.c IRQ: Maintain regs pointer globally rather than passing to IRQ handlers 2006-10-05 15:10:12 +01:00
nwbutton.h IRQ: Maintain regs pointer globally rather than passing to IRQ handlers 2006-10-05 15:10:12 +01:00
nwflash.c [PATCH] make more file_operation structs static 2006-07-03 15:26:59 -07:00
pc8736x_gpio.c [PATCH] drivers/char/pc8736x_gpio.c: remove unused static functions 2006-09-29 09:18:05 -07:00
ppdev.c IRQ: Maintain regs pointer globally rather than passing to IRQ handlers 2006-10-05 15:10:12 +01:00
pty.c [PATCH] const struct tty_operations 2006-10-02 07:57:14 -07:00
random.c Input: add missing exports to fix modular build 2006-10-11 01:43:58 -04:00
raw.c [PATCH] Streamline generic_file_* interfaces and filemap cleanups 2006-10-01 00:39:28 -07:00
riscom8.c Various drivers' irq handlers: kill dead code, needless casts 2006-10-06 15:00:58 -04:00
riscom8.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
riscom8_reg.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
rocket.c [PATCH] const struct tty_operations 2006-10-02 07:57:14 -07:00
rocket.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
rocket_int.h [PATCH] drivers/char/rocket.c: cleanups 2005-06-25 16:25:04 -07:00
rtc.c [RTC] Consistently use of tabs for formatting. 2006-10-09 23:20:47 +01:00
scan_keyb.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
scan_keyb.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
scc.h [PATCH] m68k: static vs. extern in scc.h 2006-01-12 09:09:00 -08:00
scx200_gpio.c [PATCH] scx200_gpio export cleanups 2006-09-29 09:18:06 -07:00
selection.c [PATCH] tty locking on resize 2006-09-29 09:18:12 -07:00
ser_a2232.c IRQ: Maintain regs pointer globally rather than passing to IRQ handlers 2006-10-05 15:10:12 +01:00
ser_a2232.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
ser_a2232fw.ax Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
ser_a2232fw.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
serial167.c [PATCH] serial167 __user annotations, NULL noise removal 2006-10-15 11:00:58 -07:00
snsc.c IRQ: Maintain regs pointer globally rather than passing to IRQ handlers 2006-10-05 15:10:12 +01:00
snsc.h [IA64-SGI] Handle SC env. powerdown events 2006-01-26 13:32:26 -08:00
snsc_event.c IRQ: Maintain regs pointer globally rather than passing to IRQ handlers 2006-10-05 15:10:12 +01:00
sonypi.c IRQ: Maintain regs pointer globally rather than passing to IRQ handlers 2006-10-05 15:10:12 +01:00
specialix.c [PATCH] drivers/char/specialix.c: fix the baud conversion 2006-10-17 08:18:44 -07:00
specialix_io8.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
stallion.c IRQ: Maintain regs pointer globally rather than passing to IRQ handlers 2006-10-05 15:10:12 +01:00
sx.c [PATCH] sx: fix user-visible typo (devic) 2006-10-17 08:18:45 -07:00
sx.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
sxboards.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
sxwindow.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
synclink.c [PATCH] synclink: remove PAGE_SIZE reference 2006-10-17 08:18:42 -07:00
synclink_gt.c IRQ: Maintain regs pointer globally rather than passing to IRQ handlers 2006-10-05 15:10:12 +01:00
synclinkmp.c IRQ: Maintain regs pointer globally rather than passing to IRQ handlers 2006-10-05 15:10:12 +01:00
sysrq.c [PATCH] sysrq: irq change build fix. 2006-10-06 16:38:42 +02:00
tb0219.c [PATCH] make more file_operation structs static 2006-07-03 15:26:59 -07:00
tipar.c [PATCH] pr_debug: tipar: repair nonexistant pr_debug argument use 2006-10-03 08:04:19 -07:00
tlclk.c IRQ: Maintain regs pointer globally rather than passing to IRQ handlers 2006-10-05 15:10:12 +01:00
toshiba.c [PATCH] make more file_operation structs static 2006-07-03 15:26:59 -07:00
tty_io.c [PATCH] const struct tty_operations 2006-10-02 07:57:14 -07:00
tty_ioctl.c [PATCH] Fix locking for tty drivers when doing urgent characters 2006-09-29 09:18:24 -07:00
vc_screen.c [PATCH] There is no devfs, there has never been a devfs, we have always been at war with... 2006-09-29 09:18:10 -07:00
viocons.c [POWERPC] Fix viocons for irq breakage 2006-10-07 10:10:27 +10:00
viotape.c [POWERPC] iseries: Small viotape cleanup allowed by devfs removal 2006-07-13 18:56:00 +10:00
vme_scc.c [PATCH] m68k pt_regs fixes 2006-10-07 10:51:14 -07:00
vr41xx_giu.c IRQ: Maintain regs pointer globally rather than passing to IRQ handlers 2006-10-05 15:10:12 +01:00
vt.c [PATCH] vt: proper prototypes for some console functions 2006-10-03 08:04:12 -07:00
vt_ioctl.c [PATCH] vt: Make vt_pid a struct pid (making it pid wrap around safe). 2006-10-02 07:57:14 -07:00