提交 1d7765ba 编写于 作者: A Andy Shevchenko 提交者: Bartosz Golaszewski

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: NAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: NBartosz Golaszewski <bgolaszewski@baylibre.com>
上级 85edcd01
......@@ -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);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册