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

Hans de Goede hdegoede at redhat.com
Fri Jun 17 01:05:51 PDT 2016


Hi,

On 16-06-16 11:53, Linus Walleij wrote:
> 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.

IMHO that is really something which the driver should be doing
(and in the case of phy-sun4i-usb.c where I was hitting the
NULL problem, the driver does contain these checks),
but I guess it cannot hurt.

Regards,

Hans



More information about the linux-arm-kernel mailing list