aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpio
diff options
context:
space:
mode:
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>2019-03-26 17:21:14 +0200
committerBartosz Golaszewski <bgolaszewski@baylibre.com>2019-04-04 09:34:13 +0200
commit1d7765ba15aca68f3bc52f59434c1c34855bbb54 (patch)
treed6fb55519c2e79a46e08db62cb2c6fdefbc6a72d /drivers/gpio
parentgpiolib: acpi: Fix references in kernel doc and amend (diff)
downloadlinux-dev-1d7765ba15aca68f3bc52f59434c1c34855bbb54.tar.xz
linux-dev-1d7765ba15aca68f3bc52f59434c1c34855bbb54.zip
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 <andriy.shevchenko@linux.intel.com> Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Diffstat (limited to 'drivers/gpio')
-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);