Skip to contentSkip to conversation

staging: iio: ad2s1210: remove redundant assignment to variable negative

PATCH In review Colin Ian King 2 participants 2 messages Apr 18, 2022 – Apr 24, 2022

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: iio: ad2s1210: remove redundant assignment to variable negative

Variable negative is being assigned a value that is never read, it is being re-assigned later. The assignment is redundant and can be removed.

Cleans up clang scan build warning:
drivers/staging/iio/resolver/ad2s1210.c:502:3: warning: Value stored to 'negative' is never read [deadcode.DeadStores]

---
 drivers/staging/iio/resolver/ad2s1210.c | 1 -
 1 file changed, 1 deletion(-)
drivers/staging/iio/resolver/ad2s1210.c +0 -1
index 74adb82f37c3..c0b2716d0511 100644
@@ -499,7 +499,6 @@ static int ad2s1210_read_raw(struct iio_dev *indio_dev,
 		ret = IIO_VAL_INT;
 		break;
 	case IIO_ANGL_VEL:
-		negative = st->rx[0] & 0x80;
 		vel = be16_to_cpup((__be16 *)st->rx);
 		vel >>= 16 - st->resolution;
 		if (vel & 0x8000) {
Signature · 1 line
2.35.1
maintainer
#1 lore raw
Quoted 8 lines · On Mon, 18 Apr 2022 14:46:03 +0100 Colin Ian King <[email protected]>…

Variable negative is being assigned a value that is never read, it is being re-assigned later. The assignment is redundant and can be removed.

Cleans up clang scan build warning:
drivers/staging/iio/resolver/ad2s1210.c:502:3: warning: Value stored to 'negative' is never read [deadcode.DeadStores]

Seems that someone decided to match again against the endian converted version so indeed this is pointless.

Applied to the togreg branch of iio.git and pushed out as testing for 0-day to see if it can find anything we missed.

Thanks,

Jonathan

Quoted 16 lines
---
 drivers/staging/iio/resolver/ad2s1210.c | 1 -
 1 file changed, 1 deletion(-)
drivers/staging/iio/resolver/ad2s1210.c +0 -1
index 74adb82f37c3..c0b2716d0511 100644
@@ -499,7 +499,6 @@ static int ad2s1210_read_raw(struct iio_dev *indio_dev,
 		ret = IIO_VAL_INT;
 		break;
 	case IIO_ANGL_VEL:
-		negative = st->rx[0] & 0x80;
 		vel = be16_to_cpup((__be16 *)st->rx);
 		vel >>= 16 - st->resolution;
 		if (vel & 0x8000) {