Re: [PATCH v1] gpiolib: Don't WARN on gpiod_put() for optional GPIO

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



wt., 26 mar 2019 o 16:21 Andy Shevchenko
<andriy.shevchenko@xxxxxxxxxxxxxxx> napisał(a):
>
> 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@xxxxxxxxxxxxxxx>
> ---
>  drivers/gpio/gpiolib.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
> index 144af0733581..36445e24ee89 100644
> --- a/drivers/gpio/gpiolib.c
> +++ b/drivers/gpio/gpiolib.c
> @@ -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);
>
> --
> 2.20.1
>

In that case I don't think we need to keep checking desc for NULL in
gpiod_free().

Bart




[Index of Archives]     [Linux SPI]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux