diff options
Diffstat (limited to 'drivers/video/backlight')
-rw-r--r-- | drivers/video/backlight/backlight.c | 9 | ||||
-rw-r--r-- | drivers/video/backlight/lcd.c | 9 |
2 files changed, 11 insertions, 7 deletions
diff --git a/drivers/video/backlight/backlight.c b/drivers/video/backlight/backlight.c index 9601bfe309ac..71056f8b621a 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, | |||
240 | 240 | ||
241 | rc = class_device_register(&new_bd->class_dev); | 241 | rc = class_device_register(&new_bd->class_dev); |
242 | if (unlikely(rc)) { | 242 | if (unlikely(rc)) { |
243 | error: kfree(new_bd); | 243 | kfree(new_bd); |
244 | return ERR_PTR(rc); | 244 | return ERR_PTR(rc); |
245 | } | 245 | } |
246 | 246 | ||
247 | rc = backlight_register_fb(new_bd); | 247 | rc = backlight_register_fb(new_bd); |
248 | if (unlikely(rc)) | 248 | if (rc) { |
249 | goto error; | 249 | class_device_unregister(&new_bd->class_dev); |
250 | return ERR_PTR(rc); | ||
251 | } | ||
252 | |||
250 | 253 | ||
251 | for (i = 0; i < ARRAY_SIZE(bl_class_device_attributes); i++) { | 254 | for (i = 0; i < ARRAY_SIZE(bl_class_device_attributes); i++) { |
252 | rc = class_device_create_file(&new_bd->class_dev, | 255 | rc = class_device_create_file(&new_bd->class_dev, |
diff --git a/drivers/video/backlight/lcd.c b/drivers/video/backlight/lcd.c index f6e041627edb..f95f0e33101d 100644 --- a/drivers/video/backlight/lcd.c +++ b/drivers/video/backlight/lcd.c | |||
@@ -206,14 +206,15 @@ struct lcd_device *lcd_device_register(const char *name, void *devdata, | |||
206 | 206 | ||
207 | rc = class_device_register(&new_ld->class_dev); | 207 | rc = class_device_register(&new_ld->class_dev); |
208 | if (unlikely(rc)) { | 208 | if (unlikely(rc)) { |
209 | error: kfree(new_ld); | 209 | kfree(new_ld); |
210 | return ERR_PTR(rc); | 210 | return ERR_PTR(rc); |
211 | } | 211 | } |
212 | 212 | ||
213 | rc = lcd_register_fb(new_ld); | 213 | rc = lcd_register_fb(new_ld); |
214 | 214 | if (rc) { | |
215 | if (unlikely(rc)) | 215 | class_device_unregister(&new_ld->class_dev); |
216 | goto error; | 216 | return ERR_PTR(rc); |
217 | } | ||
217 | 218 | ||
218 | for (i = 0; i < ARRAY_SIZE(lcd_class_device_attributes); i++) { | 219 | for (i = 0; i < ARRAY_SIZE(lcd_class_device_attributes); i++) { |
219 | rc = class_device_create_file(&new_ld->class_dev, | 220 | rc = class_device_create_file(&new_ld->class_dev, |