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
..
2006-10-05 15:10:12 +01:00
2006-10-20 10:26:38 -07:00
2006-06-27 09:23:59 -07:00
2006-11-14 15:15:31 -08:00
2006-10-24 16:16:39 -07:00
2006-10-28 11:30:55 -07:00
2006-11-14 15:08:50 -08:00
2006-10-30 12:08:40 -08:00
2006-10-10 16:15:33 -07:00
2006-11-16 11:43:37 -08:00
2006-10-21 13:35:05 -07:00
2006-07-31 13:28:36 -07:00
2006-10-04 07:55:30 -07:00
2006-09-21 11:46:22 +10:00
2006-10-10 15:37:21 -07:00
2006-11-03 12:27:57 -08:00
2006-10-11 11:14:25 -07:00
2006-10-25 15:12:45 -07:00
2006-10-21 18:37:02 +02:00
2006-10-18 13:03:09 -07:00
2006-10-28 22:30:17 +01:00
2006-11-14 09:09:27 -08:00
2006-10-30 15:24:38 -08:00
2006-11-13 09:52:04 -08:00
2006-10-19 16:30:32 +09:00
2006-11-06 01:46:23 -08:00
2006-10-17 08:18:46 -07:00
2006-11-15 19:57:12 -08:00
2006-10-11 11:14:25 -07:00
2006-11-08 18:29:24 -08:00
2006-11-13 09:50:11 -08:00
2006-10-30 12:08:40 -08:00
2006-10-05 15:10:12 +01:00
2006-11-06 01:46:23 -08:00
2006-11-09 07:23:54 +01:00
2006-10-27 15:34:51 -07:00
2006-11-10 11:10:51 -05:00
2006-06-30 19:25:36 +02:00
2006-09-27 08:26:18 -07:00
2006-10-06 20:47:23 -06:00
2006-10-08 12:32:35 -07:00
2006-11-14 09:09:27 -08:00
2006-10-29 17:25:48 -08:00
2006-10-18 11:36:11 -07:00
2006-10-03 22:31:37 +02:00
2006-10-17 08:18:47 -07:00
2006-10-27 12:39:33 +02:00
2006-10-27 01:03:31 -07:00
2006-11-13 07:40:43 -08:00
2006-11-10 21:35:36 +11:00
2006-10-17 08:18:42 -07:00
2006-11-03 12:27:58 -08:00
2006-10-08 02:38:28 +01:00
2006-11-08 18:29:23 -08:00
2006-11-03 11:57:19 -08:00
2006-11-14 09:09:27 -08:00
2006-10-17 08:18:44 -07:00
2006-06-30 19:25:36 +02:00
2006-10-17 08:18:42 -07:00
2006-08-10 07:31:37 -04:00