Re: [PATCH] iio: adc: ad7625: fix type mismatch in clamp() macro

From: Andy Shevchenko

Date: Wed Apr 22 2026 - 12:21:49 EST


On Wed, Apr 22, 2026 at 06:25:42PM +0400, Giorgi Tchankvetadze wrote:
> Smatch reports a type mismatch warning in ad7625_set_sampling_freq()
> where the clamp() macro is evaluating differing types:
> - `target` is a u32
> - `100` evaluates as a signed int
> - `10 * KILO` evaluates as an unsigned long (due to KILO being 1000UL)

> Replace clamp() with clamp_t(u32, ...) to explicitly cast the bounds
> to match the u32 target variable.

No. Try to avoid as much as possible use of _t variants of max(), clamp(),
and min() (the list is sorted from the least critical to the most),

Also we have constant multipliers for frequency in units.h.

--
With Best Regards,
Andy Shevchenko