mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] gpiolib: gpio_request_one(): add missing gpio_free()
@ 2010-12-09 12:58 Aaro Koskinen
  2010-12-09 13:15 ` Eric Miao
  2010-12-09 13:15 ` Eric Miao
  0 siblings, 2 replies; 3+ messages in thread
From: Aaro Koskinen @ 2010-12-09 12:58 UTC (permalink / raw)
  To: eric.y.miao, akpm, linux-kernel

If GPIO request succeeds, but configuration fails, it should be released.

Signed-off-by: Aaro Koskinen <aaro.koskinen@nokia.com>
---
 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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] gpiolib: gpio_request_one(): add missing gpio_free()
  2010-12-09 12:58 [PATCH] gpiolib: gpio_request_one(): add missing gpio_free() Aaro Koskinen
@ 2010-12-09 13:15 ` Eric Miao
  2010-12-09 13:15 ` Eric Miao
  1 sibling, 0 replies; 3+ messages in thread
From: Eric Miao @ 2010-12-09 13:15 UTC (permalink / raw)
  To: Aaro Koskinen; +Cc: akpm, linux-kernel

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

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

> ---
>  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
>
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] gpiolib: gpio_request_one(): add missing gpio_free()
  2010-12-09 12:58 [PATCH] gpiolib: gpio_request_one(): add missing gpio_free() Aaro Koskinen
  2010-12-09 13:15 ` Eric Miao
@ 2010-12-09 13:15 ` Eric Miao
  1 sibling, 0 replies; 3+ messages in thread
From: Eric Miao @ 2010-12-09 13:15 UTC (permalink / raw)
  To: Aaro Koskinen; +Cc: akpm, linux-kernel

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

Acked-by: Eric Miao <eric.y.miao@gmail.com>

> ---
>  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
>
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-12-09 13:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-12-09 12:58 [PATCH] gpiolib: gpio_request_one(): add missing gpio_free() Aaro Koskinen
2010-12-09 13:15 ` Eric Miao
2010-12-09 13:15 ` Eric Miao

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®