aboutsummaryrefslogtreecommitdiff
path: root/drivers/video/backlight/backlight.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/video/backlight/backlight.c')
-rw-r--r--drivers/video/backlight/backlight.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/drivers/video/backlight/backlight.c b/drivers/video/backlight/backlight.c
index 9601bfe309a..71056f8b621 100644
--- a/drivers/video/backlight/backlight.c
+++ b/drivers/video/backlight/backlight.c
@@ -240,13 +240,16 @@ struct backlight_device *backlight_device_register(const char *name,
rc = class_device_register(&new_bd->class_dev);
if (unlikely(rc)) {
-error: kfree(new_bd);
+ kfree(new_bd);
return ERR_PTR(rc);
}
rc = backlight_register_fb(new_bd);
- if (unlikely(rc))
- goto error;
+ if (rc) {
+ class_device_unregister(&new_bd->class_dev);
+ return ERR_PTR(rc);
+ }
+
for (i = 0; i < ARRAY_SIZE(bl_class_device_attributes); i++) {
rc = class_device_create_file(&new_bd->class_dev,