diff options
author | Ingo Molnar <mingo@elte.hu> | 2008-03-28 09:28:03 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-03-28 13:16:53 -0400 |
commit | 48d3d8263c491822d50e64547bae5f6b4a54ec59 (patch) | |
tree | 29f12143572f7ab00f309bce82c478042a899e7a | |
parent | e72e9c23ee025a4c063ca112ba0a6059f9ecc9b7 (diff) |
revert "ACPI: drivers/acpi: elide a non-zero test on a result that is never 0"
Revert commit 1192aeb957402b45f311895f124e4ca41206843c ("ACPI:
drivers/acpi: elide a non-zero test on a result that is never 0")
because it turns out that thermal_cooling_device_register() does
actually return NULL if CONFIG_THERMAL is turned off (then the routine
turns into a dummy inline routine in the header files that returns NULL
unconditionally).
This was found with randconfig testing, causing a crash during bootup:
initcall 0x78878534 ran for 13 msecs: acpi_button_init+0x0/0x51()
Calling initcall 0x78878585: acpi_fan_init+0x0/0x2c()
BUG: unable to handle kernel NULL pointer dereference at 00000000
IP: [<782b8ad0>] acpi_fan_add+0x7d/0xfd
*pde = 00000000
Oops: 0000 [#1]
Modules linked in:
Pid: 1, comm: swapper Not tainted (2.6.25-rc7-sched-devel.git-x86-latest.git #14)
EIP: 0060:[<782b8ad0>] EFLAGS: 00010246 CPU: 0
EIP is at acpi_fan_add+0x7d/0xfd
EAX: b787c718 EBX: b787c400 ECX: b782ceb4 EDX: 00000007
ESI: 00000000 EDI: b787c6f4 EBP: b782cee0 ESP: b782cecc
DS: 007b ES: 007b FS: 0000 GS: 0000 SS: 0068
Process swapper (pid: 1, ti=b782c000 task=b7846000 task.ti=b782c000)
Stack: b787c459 00000000 b787c400 78790888 b787c60c b782cef8 782b6fb8 ffffffda
b787c60c 00000000 78790958 b782cf0c 783005d7 b787c60c 78790958 78790584
b782cf1c 783007f6 b782cf28 00000000 b782cf40 782ffc4a 78790958 b794d558
Call Trace:
[<782b6fb8>] ? acpi_device_probe+0x3e/0xdb
[<783005d7>] ? driver_probe_device+0x82/0xfc
[<783007f6>] ? __driver_attach+0x3a/0x70
[<782ffc4a>] ? bus_for_each_dev+0x3e/0x60
[<7830048c>] ? driver_attach+0x14/0x16
[<783007bc>] ? __driver_attach+0x0/0x70
[<7830006a>] ? bus_add_driver+0x9d/0x1b0
[<783008c3>] ? driver_register+0x47/0xa3
[<7813db00>] ? timespec_to_ktime+0x9/0xc
[<782b7331>] ? acpi_bus_register_driver+0x3a/0x3c
[<78878592>] ? acpi_fan_init+0xd/0x2c
[<78863656>] ? kernel_init+0xac/0x1f9
[<788635aa>] ? kernel_init+0x0/0x1f9
[<78114563>] ? kernel_thread_helper+0x7/0x10
=======================
Code: 6e 78 e8 57 44 e7 ff 58 e9 93 00 00 00 8b 55 f0 8d bb f4 02 00 00 80 4b 2d 10 8b 03 e8 87 cb ff ff 8d 83 18 03 00 00 80 63 2d ef <ff> 35 00 00 00 00 50 68 e8 9c 6e 78 e8 22 44 e7 ff b9 b6 9c 6e
EIP: [<782b8ad0>] acpi_fan_add+0x7d/0xfd SS:ESP 0068:b782cecc
---[ end trace 778e504de7e3b1e3 ]---
Kernel panic - not syncing: Attempted to kill init!
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Acked-by: Julia Lawall <julia@diku.dk>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | drivers/acpi/fan.c | 34 | ||||
-rw-r--r-- | drivers/acpi/processor_core.c | 30 | ||||
-rw-r--r-- | drivers/acpi/video.c | 28 |
3 files changed, 49 insertions, 43 deletions
diff --git a/drivers/acpi/fan.c b/drivers/acpi/fan.c index 4d535c50d821..c8e3cba423ef 100644 --- a/drivers/acpi/fan.c +++ b/drivers/acpi/fan.c | |||
@@ -260,22 +260,24 @@ static int acpi_fan_add(struct acpi_device *device) | |||
260 | result = PTR_ERR(cdev); | 260 | result = PTR_ERR(cdev); |
261 | goto end; | 261 | goto end; |
262 | } | 262 | } |
263 | printk(KERN_INFO PREFIX | 263 | if (cdev) { |
264 | "%s is registered as cooling_device%d\n", | 264 | printk(KERN_INFO PREFIX |
265 | device->dev.bus_id, cdev->id); | 265 | "%s is registered as cooling_device%d\n", |
266 | 266 | device->dev.bus_id, cdev->id); | |
267 | acpi_driver_data(device) = cdev; | 267 | |
268 | result = sysfs_create_link(&device->dev.kobj, | 268 | acpi_driver_data(device) = cdev; |
269 | &cdev->device.kobj, | 269 | result = sysfs_create_link(&device->dev.kobj, |
270 | "thermal_cooling"); | 270 | &cdev->device.kobj, |
271 | if (result) | 271 | "thermal_cooling"); |
272 | return result; | 272 | if (result) |
273 | 273 | return result; | |
274 | result = sysfs_create_link(&cdev->device.kobj, | 274 | |
275 | &device->dev.kobj, | 275 | result = sysfs_create_link(&cdev->device.kobj, |
276 | "device"); | 276 | &device->dev.kobj, |
277 | if (result) | 277 | "device"); |
278 | return result; | 278 | if (result) |
279 | return result; | ||
280 | } | ||
279 | 281 | ||
280 | result = acpi_fan_add_fs(device); | 282 | result = acpi_fan_add_fs(device); |
281 | if (result) | 283 | if (result) |
diff --git a/drivers/acpi/processor_core.c b/drivers/acpi/processor_core.c index 3a136f6c66a3..36a68fa114e3 100644 --- a/drivers/acpi/processor_core.c +++ b/drivers/acpi/processor_core.c | |||
@@ -674,20 +674,22 @@ static int __cpuinit acpi_processor_start(struct acpi_device *device) | |||
674 | result = PTR_ERR(pr->cdev); | 674 | result = PTR_ERR(pr->cdev); |
675 | goto end; | 675 | goto end; |
676 | } | 676 | } |
677 | printk(KERN_INFO PREFIX | 677 | if (pr->cdev) { |
678 | "%s is registered as cooling_device%d\n", | 678 | printk(KERN_INFO PREFIX |
679 | device->dev.bus_id, pr->cdev->id); | 679 | "%s is registered as cooling_device%d\n", |
680 | 680 | device->dev.bus_id, pr->cdev->id); | |
681 | result = sysfs_create_link(&device->dev.kobj, | 681 | |
682 | &pr->cdev->device.kobj, | 682 | result = sysfs_create_link(&device->dev.kobj, |
683 | "thermal_cooling"); | 683 | &pr->cdev->device.kobj, |
684 | if (result) | 684 | "thermal_cooling"); |
685 | return result; | 685 | if (result) |
686 | result = sysfs_create_link(&pr->cdev->device.kobj, | 686 | return result; |
687 | &device->dev.kobj, | 687 | result = sysfs_create_link(&pr->cdev->device.kobj, |
688 | "device"); | 688 | &device->dev.kobj, |
689 | if (result) | 689 | "device"); |
690 | return result; | 690 | if (result) |
691 | return result; | ||
692 | } | ||
691 | 693 | ||
692 | if (pr->flags.throttling) { | 694 | if (pr->flags.throttling) { |
693 | printk(KERN_INFO PREFIX "%s [%s] (supports", | 695 | printk(KERN_INFO PREFIX "%s [%s] (supports", |
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c index fe09b57de617..12fb44f16766 100644 --- a/drivers/acpi/video.c +++ b/drivers/acpi/video.c | |||
@@ -734,19 +734,21 @@ static void acpi_video_device_find_cap(struct acpi_video_device *device) | |||
734 | if (IS_ERR(device->cdev)) | 734 | if (IS_ERR(device->cdev)) |
735 | return; | 735 | return; |
736 | 736 | ||
737 | printk(KERN_INFO PREFIX | 737 | if (device->cdev) { |
738 | "%s is registered as cooling_device%d\n", | 738 | printk(KERN_INFO PREFIX |
739 | device->dev->dev.bus_id, device->cdev->id); | 739 | "%s is registered as cooling_device%d\n", |
740 | result = sysfs_create_link(&device->dev->dev.kobj, | 740 | device->dev->dev.bus_id, device->cdev->id); |
741 | &device->cdev->device.kobj, | 741 | result = sysfs_create_link(&device->dev->dev.kobj, |
742 | "thermal_cooling"); | 742 | &device->cdev->device.kobj, |
743 | if (result) | 743 | "thermal_cooling"); |
744 | printk(KERN_ERR PREFIX "Create sysfs link\n"); | 744 | if (result) |
745 | result = sysfs_create_link(&device->cdev->device.kobj, | 745 | printk(KERN_ERR PREFIX "Create sysfs link\n"); |
746 | &device->dev->dev.kobj, | 746 | result = sysfs_create_link(&device->cdev->device.kobj, |
747 | "device"); | 747 | &device->dev->dev.kobj, |
748 | if (result) | 748 | "device"); |
749 | printk(KERN_ERR PREFIX "Create sysfs link\n"); | 749 | if (result) |
750 | printk(KERN_ERR PREFIX "Create sysfs link\n"); | ||
751 | } | ||
750 | } | 752 | } |
751 | if (device->cap._DCS && device->cap._DSS){ | 753 | if (device->cap._DCS && device->cap._DSS){ |
752 | static int count = 0; | 754 | static int count = 0; |