Commit 1d7765ba authored by Andy Shevchenko's avatar Andy Shevchenko Committed by Bartosz Golaszewski
Browse files

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: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: default avatarBartosz Golaszewski <bgolaszewski@baylibre.com>
parent 85edcd01
Loading
Loading
Loading
Loading
+2 −1
Original line number Original line Diff line number Diff line
@@ -4616,6 +4616,7 @@ EXPORT_SYMBOL_GPL(gpiod_get_array_optional);
 */
 */
void gpiod_put(struct gpio_desc *desc)
void gpiod_put(struct gpio_desc *desc)
{
{
	if (desc)
		gpiod_free(desc);
		gpiod_free(desc);
}
}
EXPORT_SYMBOL_GPL(gpiod_put);
EXPORT_SYMBOL_GPL(gpiod_put);