Skip to contentSkip to conversation

patch "iio: adc: ad7266: Fix variable checking bug" added to char-misc-linus

PATCH [email protected] 1 participant 1 message Jun 17, 2024

Subsystems (3)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

iio: adc: ad7266: Fix variable checking bug

to my char-misc git tree which can be found at
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git
in the char-misc-linus branch.

The patch will show up in the next release of the linux-next tree (usually sometime within the next 24 hours during the week.)

The patch will hopefully also be merged in Linus's tree for the next -rc kernel release.

If you have any questions about this process, please let me know.

From a2b86132955268b2a1703082fbc2d4832fc001b8 Mon Sep 17 00:00:00 2001
From: Fernando Yang <[email protected]>
Date: Mon, 3 Jun 2024 15:07:54 -0300
Subject: 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 c70df20e3159 ("iio: adc: ad7266: claim direct mode during sensor read")
---
 drivers/iio/adc/ad7266.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/iio/adc/ad7266.c +2 -0
index 353a97f9c086..13ea8a1073d2 100644
@@ -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,
Signature · 1 line
2.45.2