gpiolib: gpio_request_one(): add missing gpio_free()
authorAaro Koskinen <[email protected]>
Wed, 22 Dec 2010 01:24:22 +0000 (17:24 -0800)
committerLinus Torvalds <[email protected]>
Thu, 23 Dec 2010 03:43:33 +0000 (19:43 -0800)
If GPIO request succeeds, but configuration fails, it should be released.

Signed-off-by: Aaro Koskinen <[email protected]>
Acked-by: Eric Miao <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
drivers/gpio/gpiolib.c

index 21da9c19a0cba82e1a8aba6aa52056953efb4f82..649550e2cae99947027df5f2887e77016f554b54 100644 (file)
@@ -1281,6 +1281,9 @@ int gpio_request_one(unsigned gpio, unsigned long flags, const char *label)
                err = gpio_direction_output(gpio,
                                (flags & GPIOF_INIT_HIGH) ? 1 : 0);
 
+       if (err)
+               gpio_free(gpio);
+
        return err;
 }
 EXPORT_SYMBOL_GPL(gpio_request_one);