Skip to content
This repository was archived by the owner on Nov 8, 2023. It is now read-only.

Commit a2b8613

Browse files
fernando38954jic23
authored andcommitted
iio: adc: ad7266: Fix variable checking bug
The ret variable was not checked after iio_device_release_direct_mode(), which could possibly cause errors Fixes: c70df20 ("iio: adc: ad7266: claim direct mode during sensor read") Signed-off-by: Fernando Yang <hagisf@usp.br> Link: https://lore.kernel.org/r/20240603180757.8560-1-hagisf@usp.br Cc: <Stable@vger.kernel.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
1 parent 89b898c commit a2b8613

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

drivers/iio/adc/ad7266.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,8 @@ static int ad7266_read_raw(struct iio_dev *indio_dev,
157157
ret = ad7266_read_single(st, val, chan->address);
158158
iio_device_release_direct_mode(indio_dev);
159159

160+
if (ret < 0)
161+
return ret;
160162
*val = (*val >> 2) & 0xfff;
161163
if (chan->scan_type.sign == 's')
162164
*val = sign_extend32(*val,

0 commit comments

Comments
 (0)