Re: [PATCH] iio: pressure: abp2030pa: Remove unreachable return in abp2_read_raw()

Jonathan Cameron <[email protected]>
Newsgroups org.kernel.vger.linux-iio,org.kernel.vger.linux-kernel
Message-ID <20260727031832.484af15f@jic23-huawei>
On Sun, 26 Jul 2026 15:42:55 +0600
Siratul Islam <[email protected]> wrote:

> 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.

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


> > 
> > 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

> > 
> > Assisted-by: Claude:claude-opus-5
> > Signed-off-by: Babanpreet Singh <[email protected]>
> > ---
> >   
> LGTM.
> 
> Reviewed-by: Siratul Islam <[email protected]>
> 
> --
> Best regards,
> Sirat
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.