From: Joshua Crofts <crofts@kernel.org>
To: Arnav Kapoor <kapoorarnav43@gmail.com>
Cc: "Jonathan Cameron" <jic23@kernel.org>,
"David Lechner" <dlechner@baylibre.com>,
"Nuno Sá" <nuno.sa@analog.com>,
"Andy Shevchenko" <andy@kernel.org>,
"Andy Shevchenko" <andriy.shevchenko@intel.com>,
"Gwendal Grignou" <gwendal@chromium.org>,
"Stephen Boyd" <swboyd@chromium.org>,
linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] iio: proximity: sx9324: reject reserved gain values on read
Date: Thu, 5 Nov 2026 14:15:04 +0100 [thread overview]
Message-ID: <20261105141504.000009b8@kernel.org> (raw)
In-Reply-To: <20261104175920.207384-1-kapoorarnav43@gmail.com>
On Wed, 4 Nov 2026 23:29:18 +0530
Arnav Kapoor <kapoorarnav43@gmail.com> 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@gmail.com>
> ---
Makes sense. A stable tag is probably needed.
Reviewed-by: Joshua Crofts <crofts@kernel.org>
--
Kind regards,
Joshua Crofts
prev parent reply other threads:[~2026-11-05 13:15 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-04 17:59 [PATCH] iio: proximity: sx9324: reject reserved gain values on read Arnav Kapoor
2026-11-05 13:15 ` Joshua Crofts [this message]
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=20261105141504.000009b8@kernel.org \
--to=crofts@kernel.org \
--cc=andriy.shevchenko@intel.com \
--cc=andy@kernel.org \
--cc=dlechner@baylibre.com \
--cc=gwendal@chromium.org \
--cc=jic23@kernel.org \
--cc=kapoorarnav43@gmail.com \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nuno.sa@analog.com \
--cc=swboyd@chromium.org \
/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