lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Date:	Sun, 21 Sep 2008 23:39:28 +0900
From:	Akinobu Mita <akinobu.mita@...il.com>
To:	linux-kernel@...r.kernel.org
Cc:	Thomas Hellstrom <thomas@...gstengraphics.com>,
	Alan Hourihane <alanh@...gstengraphics.com>,
	Richard Purdie <rpurdie@...ys.net>
Subject: [PATCH] cr_bllcd: use platform_device_register_simple()

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@...il.com>
Cc: Thomas Hellstrom <thomas@...gstengraphics.com>
Cc: Alan Hourihane <alanh@...gstengraphics.com>
Cc: Richard Purdie <rpurdie@...ys.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)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ