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>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Mon, 8 Feb 2010 13:02:48 -0800
From:	Andrew Morton <akpm@...ux-foundation.org>
To:	Anton Vorontsov <avorontsov@...mvista.com>
Cc:	Grant Likely <grant.likely@...retlab.ca>,
	David Brownell <dbrownell@...rs.sourceforge.net>,
	Bill Gatliff <bgat@...lgatliff.com>,
	Dmitry Eremin-Solenikov <dbaryshkov@...il.com>,
	Benjamin Herrenschmidt <benh@...nel.crashing.org>,
	linuxppc-dev@...abs.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 3/4] of/gpio: Implement GPIOLIB notifier hooks

On Fri, 5 Feb 2010 23:32:36 +0300
Anton Vorontsov <avorontsov@...mvista.com> wrote:

> This patch implements GPIOLIB notifier hooks, and thus makes device-enabled
> GPIO chips (i.e. the ones that have gpio_chip->dev specified) automatically
> attached to the OpenFirmware subsystem. Which means that now we can handle
> I2C and SPI GPIO chips almost* transparently.
> 
> * "Almost" because some chips still require platform data, and for these
>   chips OF-glue is still needed, though with this support the glue will
>   be much smaller.
> 

We can clean this up a little with the WARN_ON trick:

diff -puN drivers/of/gpio.c~of-gpio-implement-gpiolib-notifier-hooks-fix drivers/of/gpio.c
--- a/drivers/of/gpio.c~of-gpio-implement-gpiolib-notifier-hooks-fix
+++ a/drivers/of/gpio.c
@@ -255,10 +255,8 @@ static int of_gpiochip_register_simple(s
 {
 	struct of_gpio_chip *of_gc;
 
-	if (np->data) {
-		WARN_ON(1);
+	if (WARN_ON(np->data))
 		return -EBUSY;
-	}
 
 	of_gc = kzalloc(sizeof(*of_gc), GFP_KERNEL);
 	if (!of_gc)
@@ -287,10 +285,8 @@ static int of_gpiochip_unregister(struct
 {
 	struct of_gpio_chip *of_gc = np->data;
 
-	if (!of_gc || of_gc->chip != chip) {
-		WARN_ON(1);
+	if (WARN_ON(!of_gc || of_gc->chip != chip))
 		return -EINVAL;
-	}
 
 	np->data = NULL;
 	kfree(of_gc);
_

--
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