Re: [PATCH RESEND v2] iio: accel: fxls8962af: clamp FIFO sample count

From: Jonathan Cameron

Date: Wed Aug 12 2026 - 00:58:38 EST


On Mon, 10 Aug 2026 12:27:07 +0800
"Shengzhuo Wei" <me@xxxxxxxx> wrote:

> On 2026-08-10 00:31, Jonathan Cameron wrote:
>
> > Same comments as similar patches.
> > - Not a fix, but rather hardening against buggy hardware.
> > - Don't hide the problem by clamping. If this happens in the wild
> > we want to know about it!
> >
>
> Hi Jonathan,
>
> Thanks for the feedback. I also just realized that this patch
> duplicates Bryam Vargas's "iio: accel: fxls8962af: clamp the
> device-reported FIFO sample count", which you've already applied — I
> sent mine before noticing Bryam had gotten there first.
>
> Since Bryam's is already in, how would you like to handle it? Either:
>
> - just conclude here, since Bryam's already covers fxls8962af (I'll
> drop mine); or
>
> - rework to the error-out approach you described — though your
> feedback (don't clamp, report it) applies just as much to Bryam's
> version, so that would need the same treatment.
>
Oops. That one hit me on a different day and seems didn't think of
it in the same way.

At this point I think it's probably not worth more churn for something
we don't really expect to see in practice.

However let's do things better for any other drivers we apply
similar changes to.

Thanks,

Jonathan

> If you'd like the rework, the fix I'd propose is: instead of clamping
> count to FXLS8962AF_FIFO_LENGTH, treat an out-of-range count as a
> hardware error — dev_err() and skip the flush (don't carry on
> reading), so a malfunctioning device shows up rather than being
> silently papered over.
>
> Happy to go either way.
>
> Best regards,
> Shengzhuo Wei