Re: [PATCH] gpiolib: gpio_request_one(): add missing gpio_free()

From: Eric Miao
Date: Thu Dec 09 2010 - 08:15:59 EST


On Thu, Dec 9, 2010 at 8:58 PM, Aaro Koskinen <aaro.koskinen@xxxxxxxxx> wrote:
> If GPIO request succeeds, but configuration fails, it should be released.
>
> Signed-off-by: Aaro Koskinen <aaro.koskinen@xxxxxxxxx>

Acked-by: Eric Miao <eric.miao@xxxxxxxxxxxxx>

> ---
> Âdrivers/gpio/gpiolib.c | Â Â3 +++
> Â1 files changed, 3 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
> index 21da9c1..649550e 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);
> --
> 1.5.6.5
>
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/