Re: [PATCH v2 1/3] iio: adc: ad7266: Fix variable checking bug

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

 



On Sat, 8 Jun 2024 02:06:21 -0300
Marcelo Schmitt <marcelo.schmitt1@xxxxxxxxx> wrote:

> Hi Fernando,
> 
> This patch looks good.
> I think a fixes tag would also be appropriate for this one.
> 
> Fixes: c70df20e3159 ("iio: adc: ad7266: claim direct mode during sensor read")
Agreed. 
I've picked this one for the fixes-togreg branch of iio.git and marked it
for inclusion in linux-stable.

Note this will delay when I can pick up v3 of the other two patches, but
good to get this fix upstream in the meantime.

Thanks,

Jonathan

> 
> On 06/03, Fernando Yang wrote:
> > The ret variable was not checked after iio_device_release_direct_mode(),
> > which could possibly cause errors
> > 
> > Signed-off-by: Fernando Yang <hagisf@xxxxxx>
> > ---
> >  drivers/iio/adc/ad7266.c | 2 ++
> >  1 file changed, 2 insertions(+)
> > 
> > diff --git a/drivers/iio/adc/ad7266.c b/drivers/iio/adc/ad7266.c
> > index 353a97f9c..13ea8a107 100644
> > --- a/drivers/iio/adc/ad7266.c
> > +++ b/drivers/iio/adc/ad7266.c
> > @@ -157,6 +157,8 @@ static int ad7266_read_raw(struct iio_dev *indio_dev,
> >  		ret = ad7266_read_single(st, val, chan->address);
> >  		iio_device_release_direct_mode(indio_dev);
> >  
> > +		if (ret < 0)
> > +			return ret;
> >  		*val = (*val >> 2) & 0xfff;
> >  		if (chan->scan_type.sign == 's')
> >  			*val = sign_extend32(*val,
> > -- 
> > 2.34.1
> > 
> >   





[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