From: Aaro Koskinen Date: Wed, 22 Dec 2010 01:24:22 +0000 (-0800) Subject: gpiolib: gpio_request_one(): add missing gpio_free() X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=e254811c205ec539b648cff54a7852ee8dcd2e5e;p=GitHub%2Fexynos8895%2Fandroid_kernel_samsung_universal8895.git gpiolib: gpio_request_one(): add missing gpio_free() If GPIO request succeeds, but configuration fails, it should be released. Signed-off-by: Aaro Koskinen Acked-by: Eric Miao Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index 21da9c19a0cb..649550e2cae9 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c @@ -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);