From: hdegoede@redhat.com (Hans de Goede)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] Revert "gpio: bail out silently on NULL descriptors"
Date: Fri, 17 Jun 2016 10:05:51 +0200 [thread overview]
Message-ID: <b8abb402-778b-1c02-dbad-81df966ddf97@redhat.com> (raw)
In-Reply-To: <CACRpkdbvhobvSvqifqKQFvsDqALVFUhj_8rtaAWbEFYJrug6yg@mail.gmail.com>
Hi,
On 16-06-16 11:53, Linus Walleij wrote:
> On Thu, Jun 16, 2016 at 11:23 AM, Grygorii Strashko
> <grygorii.strashko@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
next prev parent reply other threads:[~2016-06-17 8:05 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-15 18:22 [PATCH] Revert "gpio: bail out silently on NULL descriptors" Hans de Goede
2016-06-15 18:46 ` Maxime Ripard
2016-06-15 19:08 ` Hans de Goede
2016-06-16 9:23 ` Grygorii Strashko
2016-06-16 9:53 ` Linus Walleij
2016-06-17 8:05 ` Hans de Goede [this message]
2016-06-17 8:04 ` Hans de Goede
2016-06-15 21:04 ` Linus Walleij
2016-06-17 8:07 ` Hans de Goede
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=b8abb402-778b-1c02-dbad-81df966ddf97@redhat.com \
--to=hdegoede@redhat.com \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox