From: Dan Carpenter <error27@gmail.com>
To: Andy Shevchenko <andriy.shevchenko@intel.com>
Cc: Taha Narimani <tahanarimani3443@gmail.com>,
jic23@kernel.org, lars@metafoo.de, Michael.Hennerich@analog.com,
gregkh@linuxfoundation.org, dlechner@baylibre.com,
nuno.sa@analog.com, andy@kernel.org, linux-iio@vger.kernel.org,
linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] staging: iio: adc: ad7816: Use devm_gpiod_get_optional() for busy GPIO
Date: Wed, 3 Jun 2026 13:54:33 +0300 [thread overview]
Message-ID: <aiAH6eonsntoHQvF@stanley.mountain> (raw)
In-Reply-To: <aiAD7HRnWmSJb738@ashevche-desk.local>
On Wed, Jun 03, 2026 at 01:37:32PM +0300, Andy Shevchenko wrote:
> On Wed, Jun 03, 2026 at 01:20:08PM +0300, Dan Carpenter wrote:
> > On Wed, Jun 03, 2026 at 12:26:11PM +0300, Andy Shevchenko wrote:
> > > On Wed, Jun 03, 2026 at 12:33:33PM +0000, Taha Narimani wrote:
>
> ...
>
> > > > - if (chip->id == ID_AD7817) {
> > > > + if (chip->busy_pin) {
> > >
> > > If we get GPIO optional, this check wouldn't be necessary anymore as the below
> > > should return 0 IIRC in this case.
> >
> > No, it's still necessary. It can be NULL because of the CONFIG_
> > in which case, sure, gpiod_get_value() is a no-op. But it can
> > also be NULL because of the device tree and in that case we need
> > the check to avoid a NULL pointer dereference.
>
> Can you elaborate on the latter more? I fail to see that.
> What I see is that the function either implemented or not is NULL-aware.
>
Ah, yes. You're right. The VALIDATE_DESC() macro has a return hiding
inside. I hadn't seen that.
regards,
dan carpenter
next prev parent reply other threads:[~2026-06-03 10:54 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-03 12:33 [PATCH v2] staging: iio: adc: ad7816: Use devm_gpiod_get_optional() for busy GPIO Taha Narimani
2026-06-03 9:13 ` Joshua Crofts
2026-06-03 9:27 ` Andy Shevchenko
2026-06-03 9:26 ` Andy Shevchenko
2026-06-03 10:20 ` Dan Carpenter
2026-06-03 10:37 ` Andy Shevchenko
2026-06-03 10:54 ` Dan Carpenter [this message]
2026-06-03 10:52 ` Jonathan Cameron
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=aiAH6eonsntoHQvF@stanley.mountain \
--to=error27@gmail.com \
--cc=Michael.Hennerich@analog.com \
--cc=andriy.shevchenko@intel.com \
--cc=andy@kernel.org \
--cc=dlechner@baylibre.com \
--cc=gregkh@linuxfoundation.org \
--cc=jic23@kernel.org \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-staging@lists.linux.dev \
--cc=nuno.sa@analog.com \
--cc=tahanarimani3443@gmail.com \
/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