Re: [bug report] iio: adc: ad7949: add vref selection support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux