aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndy Shevchenko <[email protected]>2019-03-26 17:21:14 +0200
committerBartosz Golaszewski <[email protected]>2019-04-04 09:34:13 +0200
commit1d7765ba15aca68f3bc52f59434c1c34855bbb54 (patch)
treed6fb55519c2e79a46e08db62cb2c6fdefbc6a72d
parent85edcd01a902885fcb7bc02b7fc0f6e6a01b9386 (diff)
gpiolib: Don't WARN on gpiod_put() for optional GPIO
In case of debug and optional GPIO requested, the gpiod_put() is not aware of and will WARN, which is not the case. Make gpiod_put() NULL-aware to keep silent for optional GPIOs. Signed-off-by: Andy Shevchenko <[email protected]> Signed-off-by: Bartosz Golaszewski <[email protected]>
-rw-r--r--drivers/gpio/gpiolib.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index 144af0733581..36445e24ee89 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -4616,7 +4616,8 @@ EXPORT_SYMBOL_GPL(gpiod_get_array_optional);
*/
void gpiod_put(struct gpio_desc *desc)
{
- gpiod_free(desc);
+ if (desc)
+ gpiod_free(desc);
}
EXPORT_SYMBOL_GPL(gpiod_put);