[PATCH 1/2] drivers gpio: Check for negativ gpio values

Jan Lübbe jlu at pengutronix.de
Mon Sep 24 05:16:52 EDT 2012


On Mon, 2012-09-24 at 10:59 +0200, Teresa Gámez wrote:
>  static int gpio_is_valid(unsigned gpio)
>  {
> -	if (gpio < ARCH_NR_GPIOS)
> +	if (gpio < ARCH_NR_GPIOS && gpio >= 0)

For an 'unsigned gpio', gpio >= 0 is always true.

Regards,
Jan Lübbe
-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |




More information about the barebox mailing list