]> Git Repo - linux.git/commitdiff
gpiolib: Don't WARN on gpiod_put() for optional GPIO
authorAndy Shevchenko <[email protected]>
Tue, 26 Mar 2019 15:21:14 +0000 (17:21 +0200)
committerBartosz Golaszewski <[email protected]>
Thu, 4 Apr 2019 07:34:13 +0000 (09:34 +0200)
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]>
drivers/gpio/gpiolib.c

index 144af07335815998c7238b72e01882cf26692ef8..36445e24ee892982175ae5d25d111828f1f9812d 100644 (file)
@@ -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);
 
This page took 0.071068 seconds and 4 git commands to generate.