aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video/backlight/lcd.c
diff options
context:
space:
mode:
authorDmitry Torokhov <dtor@mail.ru>2007-02-07 17:25:50 -0500
committerRichard Purdie <rpurdie@rpsys.net>2007-02-20 03:35:09 -0500
commit2fd5a15489dd2e58009ffd4ecbadb36a40f67d2b (patch)
tree4f7406a6efbe9219f5bf78e3f112e67573efa0aa /drivers/video/backlight/lcd.c
parent7a208463b20e893e8e2074b2d41b8dc09568ddee (diff)
backlight: Fix error handling
Fix error handling when registering new device Signed-off-by: Dmitry Torokhov <dtor@mail.ru> Signed-off-by: Richard Purdie <rpurdie@rpsys.net>
Diffstat (limited to 'drivers/video/backlight/lcd.c')
-rw-r--r--drivers/video/backlight/lcd.c9
1 files changed, 5 insertions, 4 deletions
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)) {
209error: 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,