Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=2fd5a15489dd2e58009ffd4ecbadb36a40f67d2b
Commit:     2fd5a15489dd2e58009ffd4ecbadb36a40f67d2b
Parent:     7a208463b20e893e8e2074b2d41b8dc09568ddee
Author:     Dmitry Torokhov <[EMAIL PROTECTED]>
AuthorDate: Wed Feb 7 22:25:50 2007 +0000
Committer:  Richard Purdie <[EMAIL PROTECTED]>
CommitDate: Tue Feb 20 08:35:09 2007 +0000

    backlight: Fix error handling
    
    Fix error handling when registering new device
    
    Signed-off-by: Dmitry Torokhov <[EMAIL PROTECTED]>
    Signed-off-by: Richard Purdie <[EMAIL PROTECTED]>
---
 drivers/video/backlight/backlight.c |    9 ++++++---
 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 9601bfe..71056f8 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,
diff --git a/drivers/video/backlight/lcd.c b/drivers/video/backlight/lcd.c
index f6e0416..f95f0e3 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,
 
        rc = class_device_register(&new_ld->class_dev);
        if (unlikely(rc)) {
-error:         kfree(new_ld);
+               kfree(new_ld);
                return ERR_PTR(rc);
        }
 
        rc = lcd_register_fb(new_ld);
-
-       if (unlikely(rc))
-               goto error;
+       if (rc) {
+               class_device_unregister(&new_ld->class_dev);
+               return ERR_PTR(rc);
+       }
 
        for (i = 0; i < ARRAY_SIZE(lcd_class_device_attributes); i++) {
                rc = class_device_create_file(&new_ld->class_dev,
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to