From: Dmitry Torokhov <dtor@insightbb.com>
To: Richard Purdie <rpurdie@rpsys.net>
Cc: LKML <linux-kernel@vger.kernel.org>
Subject: [patch 2/6] Fix error handling when registering new device
Date: Fri, 11 Aug 2006 01:03:12 -0400 [thread overview]
Message-ID: <20060811050611.142510849.dtor@insightbb.com> (raw)
In-Reply-To: <20060811050310.958962036.dtor@insightbb.com>
[-- Attachment #1: backlight-fix-error-handling.patch --]
[-- Type: text/plain, Size: 1690 bytes --]
Backlight: fix error handling when registering new device
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
---
drivers/video/backlight/backlight.c | 8 +++++---
drivers/video/backlight/lcd.c | 8 +++++---
2 files changed, 10 insertions(+), 6 deletions(-)
Index: work/drivers/video/backlight/backlight.c
===================================================================
--- work.orig/drivers/video/backlight/backlight.c
+++ work/drivers/video/backlight/backlight.c
@@ -205,7 +205,7 @@ struct backlight_device *backlight_devic
rc = class_device_register(&new_bd->class_dev);
if (unlikely(rc)) {
-error: kfree(new_bd);
+ kfree(new_bd);
return ERR_PTR(rc);
}
@@ -213,8 +213,10 @@ error: kfree(new_bd);
new_bd->fb_notif.notifier_call = fb_notifier_callback;
rc = fb_register_client(&new_bd->fb_notif);
- if (unlikely(rc))
- goto error;
+ if (unlikely(rc)) {
+ class_device_unregister(&new_bd->class_dev);
+ return ERR_PTR(rc);
+ }
return new_bd;
}
Index: work/drivers/video/backlight/lcd.c
===================================================================
--- work.orig/drivers/video/backlight/lcd.c
+++ work/drivers/video/backlight/lcd.c
@@ -177,7 +177,7 @@ struct lcd_device *lcd_device_register(c
rc = class_device_register(&new_ld->class_dev);
if (unlikely(rc)) {
-error: kfree(new_ld);
+ kfree(new_ld);
return ERR_PTR(rc);
}
@@ -185,8 +185,10 @@ error: kfree(new_ld);
new_ld->fb_notif.notifier_call = fb_notifier_callback;
rc = fb_register_client(&new_ld->fb_notif);
- if (unlikely(rc))
- goto error;
+ if (unlikely(rc)) {
+ class_device_unregister(&new_ld->class_dev);
+ return ERR_PTR(rc);
+ }
return new_ld;
}
next prev parent reply other threads:[~2006-08-11 5:09 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-08-11 5:03 [patch 0/6] Backlight & lcd fixes/cleanups Dmitry Torokhov
2006-08-11 5:03 ` [patch 1/6] Convert to use default class device attributes Dmitry Torokhov
2006-08-11 5:03 ` Dmitry Torokhov [this message]
2006-08-11 5:03 ` [patch 3/6] Get rid of excessive amount of likely()s Dmitry Torokhov
2006-08-11 5:03 ` [patch 4/6] Remove "owner" from backlight_properties structure Dmitry Torokhov
2006-08-11 5:03 ` [patch 5/6] Convert to use mutexes instead of semaphores Dmitry Torokhov
2006-08-11 12:58 ` Dmitry Torokhov
2006-08-11 13:16 ` Richard Purdie
2006-08-11 13:34 ` Dmitry Torokhov
2006-08-11 13:42 ` Michael Hanselmann
2006-08-11 14:07 ` Dmitry Torokhov
2006-08-11 16:45 ` Richard Purdie
2006-08-11 17:20 ` Dmitry Torokhov
2006-08-29 20:54 ` Michael Hanselmann
2006-08-11 5:03 ` [patch 6/6] Move per-device data out of backlight_properties Dmitry Torokhov
2006-08-11 8:02 ` Richard Purdie
2006-08-11 12:27 ` Dmitry Torokhov
2006-08-11 12:55 ` Richard Purdie
2006-08-11 13:10 ` Dmitry Torokhov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20060811050611.142510849.dtor@insightbb.com \
--to=dtor@insightbb.com \
--cc=linux-kernel@vger.kernel.org \
--cc=rpurdie@rpsys.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®