gpiolib: Revert "Don't WARN on gpiod_put() for optional GPIO"
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Wed, 16 Apr 2025 09:55:12 +0000 (12:55 +0300)
committerBartosz Golaszewski <brgl@bgdev.pl>
Thu, 17 Apr 2025 13:22:05 +0000 (15:22 +0200)
No need to double check the pointer for NULL since gpiod_free()
is using VALIDATE_DESC_VOID() which simply returns in that case.

This reverts commit 1d7765ba15aca68f3bc52f59434c1c34855bbb54.

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20250416095645.2027695-5-andriy.shevchenko@linux.intel.com
Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
drivers/gpio/gpiolib.c

index e8e75da7b177092b2180ff33feefe07daeefe5b0..7ab408b448939d633f554c3fb25ad71bd7d630bb 100644 (file)
@@ -5140,8 +5140,7 @@ EXPORT_SYMBOL_GPL(gpiod_get_array_optional);
  */
 void gpiod_put(struct gpio_desc *desc)
 {
-       if (desc)
-               gpiod_free(desc);
+       gpiod_free(desc);
 }
 EXPORT_SYMBOL_GPL(gpiod_put);