]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
backlight: classmate-laptop - Fix missing registration failure handling
authorBruno Prémont <bonbons@linux-vserver.org>
Fri, 26 Feb 2010 11:59:39 +0000 (12:59 +0100)
committerRichard Purdie <rpurdie@linux.intel.com>
Tue, 16 Mar 2010 20:04:07 +0000 (20:04 +0000)
Check newly registered backlight_device for error and properly
return error to parent.
Mark struct backlight_ops as const.

Signed-off-by: Bruno Prémont <bonbons@linux-vserver.org>
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
drivers/platform/x86/classmate-laptop.c

index 6670ed8f9e5b4c849f4f8b853b4fda41069d2a05..c696cf1c26167cf7b19a2b63389adb683b300d3e 100644 (file)
@@ -455,7 +455,7 @@ static int cmpc_bl_update_status(struct backlight_device *bd)
                return -1;
 }
 
-static struct backlight_ops cmpc_bl_ops = {
+static const struct backlight_ops cmpc_bl_ops = {
        .get_brightness = cmpc_bl_get_brightness,
        .update_status = cmpc_bl_update_status
 };
@@ -469,6 +469,8 @@ static int cmpc_bl_add(struct acpi_device *acpi)
        props.max_brightness = 7;
        bd = backlight_device_register("cmpc_bl", &acpi->dev, acpi->handle,
                                       &cmpc_bl_ops, &props);
+       if (IS_ERR(bd))
+               return PTR_ERR(bd);
        dev_set_drvdata(&acpi->dev, bd);
        return 0;
 }