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

Teresa Gámez t.gamez at phytec.de
Mon Sep 24 04:59:35 EDT 2012


Signed-off-by: Teresa Gámez <t.gamez at phytec.de>
---
 drivers/gpio/gpio.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/gpio/gpio.c b/drivers/gpio/gpio.c
index 6ad8d27..0966e2a 100644
--- a/drivers/gpio/gpio.c
+++ b/drivers/gpio/gpio.c
@@ -10,7 +10,7 @@ static struct gpio_chip *gpio_desc[ARCH_NR_GPIOS];
 
 static int gpio_is_valid(unsigned gpio)
 {
-	if (gpio < ARCH_NR_GPIOS)
+	if (gpio < ARCH_NR_GPIOS && gpio >= 0)
 		return 1;
 	return 0;
 }
-- 
1.7.0.4




More information about the barebox mailing list