Re: [bug report] mfd: lp87565: Handle optional reset pin

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

 



On Thu, Nov 18, 2021 at 10:22:52AM +0100, Luca Ceresoli wrote:
> 
> As the author of the code to blame, I wrote this patch, but just needed
> a little time to test it before sending:
> 
>     lp87565->reset_gpio = devm_gpiod_get_optional(lp87565->dev, "reset",
>                                                   GPIOD_OUT_LOW);
>     if (IS_ERR(lp87565->reset_gpio))
>         return dev_err_probe(lp87565->dev, PTR_ERR(lp87565->reset_gpio),
>                              "Failed getting reset GPIO");
> 
>     if (lp87565->reset_gpio) {
>     ...
> 
> I prefer to exit on any error as it would be either -EPROBE_DEFER of a
> _real_ error (e.g. GPIO already in use). If there's no GPIO specified,
> then devm_gpiod_get_optional() returns NULL and libgpio ignores NULL
> pointers gracefully.
> 
> Would that work?

I generally prefer that as well, because to me optional means it's up to
the user not that it's up to the kernel.  But it depends on if the
system can boot without it etc...

I guess in this case we know that no one was relying on the old behavior
because that would have crashed so returning errors is safe.

regards,
dan carpenter



[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux