summaryrefslogtreecommitdiffstats
path: root/drivers/acpi
diff options
context:
space:
mode:
authorZhang Rui <rui.zhang@intel.com>2009-07-29 02:53:29 +0200
committerLen Brown <len.brown@intel.com>2009-12-30 07:51:07 +0100
commite01ce79b7f6ebc5b57128ee058811aa8f9059319 (patch)
tree733b3b5aac2bc87a60b67bfe8ba75f3006a97d48 /drivers/acpi
parentLinux 2.6.33-rc2 (diff)
downloadlinux-e01ce79b7f6ebc5b57128ee058811aa8f9059319.tar.xz
linux-e01ce79b7f6ebc5b57128ee058811aa8f9059319.zip
ACPI video: correct error-handling code
backlight_device_register may return an ERR_PTR value rather than a valid pointer. Problem found by Julia Lawall, properly fixed by Zhang Rui. Signed-off-by: Zhang Rui <rui.zhang@intel.com> Acked-by: Julia Lawall <julia@diku.dk> Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi')
-rw-r--r--drivers/acpi/video.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c
index 05dff631591c..3f685db1a76d 100644
--- a/drivers/acpi/video.c
+++ b/drivers/acpi/video.c
@@ -999,8 +999,10 @@ static void acpi_video_device_find_cap(struct acpi_video_device *device)
sprintf(name, "acpi_video%d", count++);
device->backlight = backlight_device_register(name,
NULL, device, &acpi_backlight_ops);
- device->backlight->props.max_brightness = device->brightness->count-3;
kfree(name);
+ if (IS_ERR(device->backlight))
+ return;
+ device->backlight->props.max_brightness = device->brightness->count-3;
result = sysfs_create_link(&device->backlight->dev.kobj,
&device->dev->dev.kobj, "device");