Skip to contentSkip to conversation

iio: pressure: abp2030pa: Remove unreachable return in abp2_read_raw()

PATCH In review Babanpreet Singh 3 participants 3 messages Jul 26 – Jul 27

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

PATCH 1/1 iio: pressure: abp2030pa: Remove unreachable return in abp2_read_raw()

In the IIO_CHAN_INFO_RAW case every arm of the inner switch on channel->type returns - IIO_PRESSURE and IIO_TEMP return IIO_VAL_INT and default returns -EINVAL - so the "return IIO_VAL_INT;" following that switch cannot be reached. The sibling IIO_CHAN_INFO_SCALE and IIO_CHAN_INFO_OFFSET cases have the same shape and no trailing return, so drop it here as well.

Found by smatch:
drivers/iio/pressure/abp2030pa.c:382 abp2_read_raw() warn: ignoring unreachable code.

No functional change: the compiler already discarded the statement, and the generated object code is identical before and after.

Assisted-by Claude:claude-opus-5
---
 drivers/iio/pressure/abp2030pa.c | 1 -
 1 file changed, 1 deletion(-)
drivers/iio/pressure/abp2030pa.c +0 -1
index b44f1bf4c633..41395036e9ad 100644
@@ -379,7 +379,6 @@ static int abp2_read_raw(struct iio_dev *indio_dev,
 		default:
 			return -EINVAL;
 		}
-		return IIO_VAL_INT;
 
 	case IIO_CHAN_INFO_SCALE:
 		switch (channel->type) {
Signature · 1 line
2.43.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 10 lines · Babanpreet Singh

In the IIO_CHAN_INFO_RAW case every arm of the inner switch on channel->type returns - IIO_PRESSURE and IIO_TEMP return IIO_VAL_INT and default returns -EINVAL - so the "return IIO_VAL_INT;" following that switch cannot be reached. The sibling IIO_CHAN_INFO_SCALE and IIO_CHAN_INFO_OFFSET cases have the same shape and no trailing return, so drop it here as well.

Found by smatch:
drivers/iio/pressure/abp2030pa.c:382 abp2_read_raw() warn: ignoring unreachable code.

Quoted 7 lines

No functional change: the compiler already discarded the statement, and the generated object code is identical before and after.

Assisted-by Claude:claude-opus-5

---

LGTM.

--
Best regards,
Sirat

maintainer
#2 lore raw
Quoted 7 lines · On Sun, 26 Jul 2026 15:42:55 +0600 Siratul Islam <[email protected]>…
Quoted 6 lines · Babanpreet Singh

In the IIO_CHAN_INFO_RAW case every arm of the inner switch on channel->type returns - IIO_PRESSURE and IIO_TEMP return IIO_VAL_INT and default returns -EINVAL - so the "return IIO_VAL_INT;" following that switch cannot be reached. The sibling IIO_CHAN_INFO_SCALE and IIO_CHAN_INFO_OFFSET cases have the same shape and no trailing return, so drop it here as well.

A bit too much detail. Just saying they all already returned is fine; we don't need to know what was returned.

Quoted 6 lines
Quoted 6 lines

Found by smatch:
drivers/iio/pressure/abp2030pa.c:382 abp2_read_raw() warn: ignoring unreachable code.

No functional change: the compiler already discarded the statement, and the generated object code is identical before and after.

Sensible check to perform but no need to state it in the patch description.

I tweaked the description whilst applying.

Applied to the testing branch of iio.git on git.kernel.org

Thanks

Jonathan

Quoted 12 lines
Quoted 5 lines
Assisted-by Claude:claude-opus-5

---

LGTM.

--
Best regards,
Sirat