MX1/MX2: -EINVAL overwritten in second iteration in mxc_gpio_setup_multiple_pins()
authorRoel Kluin <roel.kluin@gmail.com>
Wed, 3 Feb 2010 19:19:00 +0000 (20:19 +0100)
committerSascha Hauer <s.hauer@pengutronix.de>
Thu, 4 Feb 2010 08:33:10 +0000 (09:33 +0100)
Due to the `ret = gpio_request()' below in the loop, the initial -EINVAL value
of ret is overwritten.

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
arch/arm/plat-mxc/iomux-mx1-mx2.c

index a37163c..25023ac 100644 (file)
@@ -116,14 +116,16 @@ int mxc_gpio_setup_multiple_pins(const int *pin_list, unsigned count,
        int i;
        unsigned gpio;
        unsigned mode;
-       int ret = -EINVAL;
+       int ret;
 
        for (i = 0; i < count; i++) {
                gpio = *p & (GPIO_PIN_MASK | GPIO_PORT_MASK);
                mode = *p & ~(GPIO_PIN_MASK | GPIO_PORT_MASK);
 
-               if (gpio >= (GPIO_PORT_MAX + 1) * 32)
+               if (gpio >= (GPIO_PORT_MAX + 1) * 32) {
+                       ret = -EINVAL;
                        goto setup_error;
+               }
 
                ret = gpio_request(gpio, label);
                if (ret)