public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] cr_bllcd: use platform_device_register_simple()
@ 2008-09-21 14:39 Akinobu Mita
  0 siblings, 0 replies; only message in thread
From: Akinobu Mita @ 2008-09-21 14:39 UTC (permalink / raw)
  To: linux-kernel; +Cc: Thomas Hellstrom, Alan Hourihane, Richard Purdie

This change also fixes error handling when platform_device_alloc() fails.
(When platform_device_alloc() failed, it returns error without
unregistering cr_backlight_driver)

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Cc: Thomas Hellstrom <thomas@tungstengraphics.com>
Cc: Alan Hourihane <alanh@tungstengraphics.com>
Cc: Richard Purdie <rpurdie@rpsys.net>
---
 drivers/video/backlight/cr_bllcd.c |   20 ++++++++------------
 1 file changed, 8 insertions(+), 12 deletions(-)

Index: 2.6-git/drivers/video/backlight/cr_bllcd.c
===================================================================
--- 2.6-git.orig/drivers/video/backlight/cr_bllcd.c
+++ 2.6-git/drivers/video/backlight/cr_bllcd.c
@@ -259,22 +259,18 @@ static int __init cr_backlight_init(void
 {
 	int ret = platform_driver_register(&cr_backlight_driver);
 
-	if (!ret) {
-		crp = platform_device_alloc("cr_backlight", -1);
-		if (!crp)
-			return -ENOMEM;
-
-		ret = platform_device_add(crp);
-
-		if (ret) {
-			platform_device_put(crp);
-			platform_driver_unregister(&cr_backlight_driver);
-		}
+	if (ret)
+		return ret;
+
+	crp = platform_device_register_simple("cr_backlight", -1, NULL, 0);
+	if (IS_ERR(crp)) {
+		platform_driver_unregister(&cr_backlight_driver);
+		return PTR_ERR(crp);
 	}
 
 	printk("Carillo Ranch Backlight Driver Initialized.\n");
 
-	return ret;
+	return 0;
 }
 
 static void __exit cr_backlight_exit(void)

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2008-09-21 14:39 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-09-21 14:39 [PATCH] cr_bllcd: use platform_device_register_simple() Akinobu Mita

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox