[PATCH] Revert "gpio: bail out silently on NULL descriptors"

Linus Walleij linus.walleij at linaro.org
Thu Jun 16 02:53:12 PDT 2016


On Thu, Jun 16, 2016 at 11:23 AM, Grygorii Strashko
<grygorii.strashko at ti.com> wrote:
> On 06/15/2016 10:08 PM, Hans de Goede wrote:

>>>> This commit causes the following code to fail:
>>>>
>>>> gpio_desc = devm_gpiod_get_optional(dev, ...);
>
> May be I missed smth., but in this example gpio_desc may contain err code.
>
>>>> gpio_irq  = gpiod_to_irq(gpio_desc);
> which, most probably will cause gpiod_to_irq() to crash
>         if (!desc) \
>                 return 0; \
>         if (!desc->gdev) { \
> ^^^^^^^^^^^^^ here

Hm good catch. These optional GPIOs may never have worked properly,
good that they are so rare :/

I'll send a separate patch making some IS_ERR() checks.

Yours,
Linus Walleij



More information about the linux-arm-kernel mailing list