Re: [PATCH v1 1/1] iio: adc: nxp-sar-adc: Avoid division by zero

From: Jonathan Cameron

Date: Sun Apr 19 2026 - 13:17:15 EST


On Thu, 16 Apr 2026 11:01:22 +0200
Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx> wrote:

> When Common Clock Framework is disabled, clk_get_rate() returns 0.
> This is used as part of the divisor to perform nanosecond delays
> with help of ndelay(). When the above condition occurs the compiler,
> due to unspecified behaviour, is free to do what it wants to. Here
> it saturates the value, which is logical from mathematics point of
> view. However, the ndelay() implementation has set a reasonable
> upper threshold and refuses to provide anything for such a long
> delay. That's why code may not be linked under these circumstances.
>
> To solve the issue, provide a wrapper that calls ndelay() when
> the value is known not to be zero.
>
> Fixes: 4434072a893e ("iio: adc: Add the NXP SAR ADC support for the s32g2/3 platforms")
> Reported-by: kernel test robot <lkp@xxxxxxxxx>
> Closes: https://lore.kernel.org/oe-kbuild-all/202603311958.ly6uROit-lkp@xxxxxxxxx/
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>
Applied to the fixes-togreg branch of iio.git and marked for stable.
Thanks,

Jonathan