Re: [PATCH] iio: proximity: sx9324: reject reserved gain values on read
From: Jonathan Cameron
Date: Sat Nov 07 2026 - 15:35:27 EST
On Thu, 5 Nov 2026 14:15:04 +0100
Joshua Crofts <crofts@xxxxxxxxxx> wrote:
> On Wed, 4 Nov 2026 23:29:18 +0530
> Arnav Kapoor <kapoorarnav43@xxxxxxxxx> wrote:
>
> > sx9324_read_gain() is meant to return -EINVAL for the reserved
> > PROX_CTRL0 gain codes, 0 and 5 to 7. But the range check sits in the
> > else branch of "if (regval)", where regval is always 0, so codes 5 to 7
> > are never caught and are reported as gains of 16, 32 and 64, which the
> > sensor doesn't support and which write_raw() rejects.
> >
> > Check both reserved ranges before converting the code to a gain.
> >
> > Fixes: 108e4d4de2b5 ("iio:proximity:sx9324: Fix hardware gain read/write")
> > Signed-off-by: Arnav Kapoor <kapoorarnav43@xxxxxxxxx>
> > ---
>
> Makes sense. A stable tag is probably needed.
>
> Reviewed-by: Joshua Crofts <crofts@xxxxxxxxxx>
>
Seems correct and I can add the stable tag. I'll leave this on list
for now so that perhaps Stephen has time to take a look.
Thanks,
Jonathan