From: Liam Beguin <liambeguin@gmail.com>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: lvb@xiphos.com, linux-iio@vger.kernel.org
Subject: Re: [bug report] iio: adc: ad7949: add vref selection support
Date: Thu, 23 Sep 2021 20:21:02 -0400 [thread overview]
Message-ID: <YU0Z7sMsu6i9YkYh@shaak> (raw)
In-Reply-To: <20210923054358.GX2116@kadam>
On Thu, Sep 23, 2021 at 08:47:52AM +0300, Dan Carpenter wrote:
> > > > if (ret != -ENODEV)
> > > > return ret;
> > > > /* unbuffered? */
> > > > ad7949_adc->vref = devm_regulator_get_optional(dev, "vref");
> > > > if (IS_ERR(ad7949_adc->vref)) {
> > > > ret = PTR_ERR(ad7949_adc->vref);
> > > > + ad7949_adc->vref = NULL;
> > >
> > > But this also won't work. Passing a NULL to regulator_enable() will
> > > cause an Oops. All the reference to ->vref need checks. :/
> >
> > I believe it still work since these conditions around
> > devm_regulator_get_optional() also set ad7949_adc->refsel.
> >
> > ad7949_adc->refsel is then checked before calling regulator_enable() and
> > regulator_get_voltage().
> >
> > Even without the patch, I don't think we can call regulor_enable()
> > without having it be defined. Am I missing something else?
Hi Dan,
> Actually, you're right. This warning is a 100% false positive. Smatch
> doesn't handle bit wise tests very well. I've been meaning to write
> that code but I haven't done it yet. When I do the false positive will
> go away.
>
> Sorry for the noise on this.
No worries, thanks for your support on this.
> regards,
> dan carpenter
Liam
prev parent reply other threads:[~2021-09-24 0:21 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-21 6:35 [bug report] iio: adc: ad7949: add vref selection support Dan Carpenter
2021-09-22 5:10 ` Liam Beguin
2021-09-22 6:00 ` Dan Carpenter
2021-09-22 14:48 ` Liam Beguin
2021-09-23 5:47 ` Dan Carpenter
2021-09-24 0:21 ` Liam Beguin [this message]
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=YU0Z7sMsu6i9YkYh@shaak \
--to=liambeguin@gmail.com \
--cc=dan.carpenter@oracle.com \
--cc=linux-iio@vger.kernel.org \
--cc=lvb@xiphos.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;
as well as URLs for NNTP newsgroup(s).