iio: pressure: abp2030pa: Remove unreachable return in abp2_read_raw()
Subsystems (2)
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.
--- drivers/iio/pressure/abp2030pa.c | 1 - 1 file changed, 1 deletion(-)
drivers/iio/pressure/abp2030pa.c +0 -1
@@ -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
Quoted 10 lines · Babanpreet Singh
In the
IIO_CHAN_INFO_RAWcase every arm of the inner switch onchannel->typereturns -IIO_PRESSUREandIIO_TEMPreturnIIO_VAL_INTand default returns-EINVAL- so the "returnIIO_VAL_INT;" following that switch cannot be reached. The siblingIIO_CHAN_INFO_SCALEandIIO_CHAN_INFO_OFFSETcases have the same shape and no trailing return, so drop it here as well.Found by smatch:
drivers/iio/pressure/abp2030pa.c:382abp2_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-5Signed-off-by Babanpreet Singh <[email protected]>---
LGTM.
--
Best regards,
Sirat
Jonathan Cameron
maintainerQuoted 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_RAWcase every arm of the inner switch onchannel->typereturns -IIO_PRESSUREandIIO_TEMPreturnIIO_VAL_INTand default returns-EINVAL- so the "returnIIO_VAL_INT;" following that switch cannot be reached. The siblingIIO_CHAN_INFO_SCALEandIIO_CHAN_INFO_OFFSETcases 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:382abp2_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-5Signed-off-by Babanpreet Singh <[email protected]>---
LGTM.
Reviewed-by Siratul Islam <[email protected]>--
Best regards,
Sirat