From: Babanpreet Singh <bbnpreetsingh@gmail.com>
To: Jonathan Cameron <jic23@kernel.org>,
Petre Rodan <petre.rodan@subdimension.ro>
Cc: "David Lechner" <dlechner@baylibre.com>,
"Nuno Sá" <nuno.sa@analog.com>,
"Andy Shevchenko" <andy@kernel.org>,
linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org,
"Babanpreet Singh" <bbnpreetsingh@gmail.com>
Subject: [PATCH] iio: pressure: abp2030pa: Remove unreachable return in abp2_read_raw()
Date: Sun, 26 Jul 2026 07:22:34 +0000 [thread overview]
Message-ID: <20260726072234.7-1-bbnpreetsingh@gmail.com> (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
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
next reply other threads:[~2026-07-26 7:22 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-26 7:22 Babanpreet Singh [this message]
2026-07-26 9:42 ` [PATCH] iio: pressure: abp2030pa: Remove unreachable return in abp2_read_raw() Siratul Islam
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260726072234.7-1-bbnpreetsingh@gmail.com \
--to=bbnpreetsingh@gmail.com \
--cc=andy@kernel.org \
--cc=dlechner@baylibre.com \
--cc=jic23@kernel.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nuno.sa@analog.com \
--cc=petre.rodan@subdimension.ro \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox