gpiolib: gpio_request_one(): add missing gpio_free()
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>
This commit is contained in:
parent
d153ba6445
commit
e254811c20
1 changed files with 3 additions and 0 deletions
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue