All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] iio: pressure: abp2030pa: Remove unreachable return in abp2_read_raw()
@ 2026-07-26  7:22 Babanpreet Singh
  2026-07-26  9:42 ` Siratul Islam
  0 siblings, 1 reply; 2+ messages in thread
From: Babanpreet Singh @ 2026-07-26  7:22 UTC (permalink / raw)
  To: Jonathan Cameron, Petre Rodan
  Cc: David Lechner, Nuno Sá, Andy Shevchenko, linux-iio,
	linux-kernel, 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.

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
Signed-off-by: Babanpreet Singh <bbnpreetsingh@gmail.com>
---
 drivers/iio/pressure/abp2030pa.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/iio/pressure/abp2030pa.c b/drivers/iio/pressure/abp2030pa.c
index b44f1bf4c633..41395036e9ad 100644
--- a/drivers/iio/pressure/abp2030pa.c
+++ b/drivers/iio/pressure/abp2030pa.c
@@ -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) {
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] iio: pressure: abp2030pa: Remove unreachable return in abp2_read_raw()
  2026-07-26  7:22 [PATCH] iio: pressure: abp2030pa: Remove unreachable return in abp2_read_raw() Babanpreet Singh
@ 2026-07-26  9:42 ` Siratul Islam
  0 siblings, 0 replies; 2+ messages in thread
From: Siratul Islam @ 2026-07-26  9:42 UTC (permalink / raw)
  To: Babanpreet Singh, Jonathan Cameron, Petre Rodan
  Cc: David Lechner, Nuno Sá, Andy Shevchenko, linux-iio,
	linux-kernel

On Sun, 2026-07-26 at 07:22 +0000, Babanpreet Singh wrote:
> 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
> Signed-off-by: Babanpreet Singh <bbnpreetsingh@gmail.com>
> ---
> 
LGTM.

Reviewed-by: Siratul Islam <siratul.islam@linux.dev>

--
Best regards,
Sirat

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-07-26  9:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-26  7:22 [PATCH] iio: pressure: abp2030pa: Remove unreachable return in abp2_read_raw() Babanpreet Singh
2026-07-26  9:42 ` Siratul Islam

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.