提交 f0af7899 编写于 作者: B Bruno Prémont 提交者: Richard Purdie

backlight: classmate-laptop - Fix missing registration failure handling

Check newly registered backlight_device for error and properly
return error to parent.
Mark struct backlight_ops as const.
Signed-off-by: NBruno Prémont <bonbons@linux-vserver.org>
Signed-off-by: NRichard Purdie <rpurdie@linux.intel.com>
上级 36bc5ee6
...@@ -455,7 +455,7 @@ static int cmpc_bl_update_status(struct backlight_device *bd) ...@@ -455,7 +455,7 @@ static int cmpc_bl_update_status(struct backlight_device *bd)
return -1; return -1;
} }
static struct backlight_ops cmpc_bl_ops = { static const struct backlight_ops cmpc_bl_ops = {
.get_brightness = cmpc_bl_get_brightness, .get_brightness = cmpc_bl_get_brightness,
.update_status = cmpc_bl_update_status .update_status = cmpc_bl_update_status
}; };
...@@ -469,6 +469,8 @@ static int cmpc_bl_add(struct acpi_device *acpi) ...@@ -469,6 +469,8 @@ static int cmpc_bl_add(struct acpi_device *acpi)
props.max_brightness = 7; props.max_brightness = 7;
bd = backlight_device_register("cmpc_bl", &acpi->dev, acpi->handle, bd = backlight_device_register("cmpc_bl", &acpi->dev, acpi->handle,
&cmpc_bl_ops, &props); &cmpc_bl_ops, &props);
if (IS_ERR(bd))
return PTR_ERR(bd);
dev_set_drvdata(&acpi->dev, bd); dev_set_drvdata(&acpi->dev, bd);
return 0; return 0;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册