summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorFernando Yang <hagisf@usp.br>2024-06-03 15:07:54 -0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2024-07-05 09:12:52 +0200
commit28f6d0b5ff9f4a1638f8e2840359deb296716a88 (patch)
tree955ef84d5ae5e8f1247510a3dc8d79f178ee3328 /drivers
parent78ece307f82397629be958bc46d7573b4fe3cc86 (diff)
iio: adc: ad7266: Fix variable checking bug
commit a2b86132955268b2a1703082fbc2d4832fc001b8 upstream. The ret variable was not checked after iio_device_release_direct_mode(), which could possibly cause errors Fixes: c70df20e3159 ("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> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/iio/adc/ad7266.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/iio/adc/ad7266.c b/drivers/iio/adc/ad7266.c
index a8ec3efd659e..90b9ac589e90 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, 11);