Re: [PATCH] iio: accel: sca3000: fix frequency divider condition check

Jonathan Cameron <[email protected]>
Newsgroups org.kernel.vger.linux-iio,org.kernel.vger.linux-kernel
Message-ID <20260823014841.0ec4be19@jic23-huawei>
On Wed, 19 Aug 2026 13:51:56 +0200
Joshua Crofts <[email protected]> wrote:

> On Wed, 19 Aug 2026 12:41:01 +0100
> Salah Triki <[email protected]> wrote:
> 
> > When setting the sampling frequency, the check for `base_freq / 2` is
> > followed by an independent `if` statement for `base_freq / 4`. If `val`
> > equals `base_freq / 2`, the second check fails and falls through to the
> > `else if (val != base_freq)` branch, returning `-EINVAL` erroneously.
> > 
> > Fix this by chaining the checks with `else if`.
> > 
> > Signed-off-by: Salah Triki <[email protected]>
> > ---  
> 
> Good catch, this issue is 10 years old!
> 
> However, you're missing a fixes tag, I think b4 will pick it up
> if I leave it here since I already ran git blame.
> 
> Fixes: e0f3fc9b47e6 ("iio: accel: sca3000_core: implemented IIO_CHAN_INFO_SAMP_FREQ")
Thanks - b4 indeed picks it up. It saves me time even though b4 puts it
in the wrong place (well the right place given it came from the thread, but
wrong as it should have been there in the first place).
> 
> + cc stable
> 
> Reviewed-by: Joshua Crofts <[email protected]>

Applied to the fixes-togreg branch of iio.git and marked for stable.

Thanks,

Jonathan

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