From f0af78991363d704694a3618b638662c97d8a110 Mon Sep 17 00:00:00 2001 From: Bruno Prémont Date: Fri, 26 Feb 2010 12:59:39 +0100 Subject: backlight: classmate-laptop - Fix missing registration failure handling MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Signed-off-by: Richard Purdie --- drivers/platform/x86/classmate-laptop.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'drivers') diff --git a/drivers/platform/x86/classmate-laptop.c b/drivers/platform/x86/classmate-laptop.c index 6670ed8f9e5..c696cf1c261 100644 --- a/drivers/platform/x86/classmate-laptop.c +++ b/drivers/platform/x86/classmate-laptop.c @@ -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; } -- cgit v1.2.3-70-g09d2