Re: [PATCH] iio: pressure: abp2030pa: Remove unreachable return in abp2_read_raw()
From: Jonathan Cameron
Date: Sun Jul 26 2026 - 22:18:54 EST
On Sun, 26 Jul 2026 15:42:55 +0600
Siratul Islam <siratul.islam@xxxxxxxxx> 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 <bbnpreetsingh@xxxxxxxxx>
> > ---
> >
> LGTM.
>
> Reviewed-by: Siratul Islam <siratul.islam@xxxxxxxxx>
>
> --
> Best regards,
> Sirat