1
0
Fork 0

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>
hifive-unleashed-5.2
Andy Shevchenko 2019-03-26 17:21:14 +02:00 committed by Bartosz Golaszewski
parent 85edcd01a9
commit 1d7765ba15
1 changed files with 2 additions and 1 deletions

View 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);