mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Joshua Crofts <crofts@kernel.org>
Cc: "Arnav Kapoor" <kapoorarnav43@gmail.com>,
	"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: Sun, 15 Nov 2026 00:31:43 +0000	[thread overview]
Message-ID: <20261115003143.44a65e15@jic23-hlaptop> (raw)
In-Reply-To: <20261107203508.30be5cf2@jic23-hlaptop>

On Sat, 7 Nov 2026 20:35:08 +0000
Jonathan Cameron <jic23@kernel.org> wrote:

> On Thu, 5 Nov 2026 14:15:04 +0100
> Joshua Crofts <crofts@kernel.org> wrote:
> 
> > 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>
> >   
> 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.

Given nothing back from Stephen I'm going to apply this, but not
rush it in. So applied to the testing branch of iio.git which is lining
stuff up for the next merge cycle.

Thanks,

Jonathan
> 
> Thanks,
> 
> Jonathan
> 
> 


      reply	other threads:[~2026-11-15  0:31 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-04 17:59 Arnav Kapoor
2026-11-05 13:15 ` Joshua Crofts
2026-11-07 20:35   ` Jonathan Cameron
2026-11-15  0:31     ` Jonathan Cameron [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=20261115003143.44a65e15@jic23-hlaptop \
    --to=jic23@kernel.org \
    --cc=andriy.shevchenko@intel.com \
    --cc=andy@kernel.org \
    --cc=crofts@kernel.org \
    --cc=dlechner@baylibre.com \
    --cc=gwendal@chromium.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

all inboxes | Powered by JetHome®