Skip to content

Commit

Permalink
gpiolib: gpio_request_one(): add missing gpio_free()
Browse files Browse the repository at this point in the history
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>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Aaro Koskinen authored and Linus Torvalds committed Dec 23, 2010
1 parent d153ba6 commit e254811
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions drivers/gpio/gpiolib.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit e254811

Please sign in to comment.