Re: [PATCH v3 7/8] iio: light: si1133: reset counter to prevent race condition

Andy Shevchenko
2026-04-29T19:24:04Z

On Wed, Apr 29, 2026 at 05:04:55PM +0200, Joshua Crofts via B4 Relay wrote:

> Sashiko reported a potential race condition happening when the driver
> returns an errno after a timeout in the si1133_command() function. The
> premature exit causes the hardware and software counters to become out
> of sync by not updating data->rsp_seq, therefore the internal hardware
> counter keeps incrementing.
>
> Fix this by adding a call to si1133_cmd_reset_counter() before returing
> from timeout.
>
> Closes: https://sashiko.dev/#/message/20260428-si1133-checkup-v2-5-70ad14bfefe2%40gmail.com
> Assisted-by: gemini:gemini-3.1-pro-preview

Reported-by: sashiko-bot@... // there is an email mentioned in some thread in
// linux-iio mailing list.

,,,

> + /*
> + * reset counter on err to prevent sofware and hardware
> + * counters being out of sync
> + */

/*
* Respect English grammar and punctuation. This is
* the style for multi-line comments. You can consider
* this example.
*/

--
With Best Regards,
Andy Shevchenko