Re: [PATCH] iio: inv_sensors: fix estimated value larger than interrupt timestamp

From: Andy Shevchenko

Date: Mon Aug 24 2026 - 11:43:01 EST


On Mon, Aug 24, 2026 at 05:16:58PM +0200, Jean-Baptiste Maneyrol via B4 Relay wrote:

> When interrupt timestamp interval is not valid, we use an estimated value
> that can in rare case be bigger than the interrupt timestamp. This is
> obviously wrong, so better use interrupt timestamp in this case.

...

> - ts->period = ts->mult * ts->chip_period.val;
> + ts->period = min(ts->mult * ts->chip_period.val, period);

It's u32 * u32, how is this guaranteed to be always under the u32 result?

--
With Best Regards,
Andy Shevchenko