aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video/backlight/backlight.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/backlight.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/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 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)) {
243error: 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,