Re: [PATCH v2] iio: adc: ti-ads1018: fix type overflow for data rate

From: Andy Shevchenko

Date: Fri Mar 06 2026 - 07:10:37 EST


On Thu, Mar 05, 2026 at 08:43:02PM +0800, Chunyang Chen wrote:
> The variable 'drate' is currently defined as u8. However, the data rate
> values in ads1018 can reach up to 3300 Hz, which exceeds the maximum
> value of 255 that a u8 can hold.
>
> Change the type of 'drate' to u32 to match the data_rate_mode_to_hz
> array definition and ensure the data rate is handled correctly.
>
> Fixes: bf0bba486b5b ("iio: adc: ti-ads1018: add ti-ads1018 driver")
> Signed-off-by: Chunyang Chen <chenchunyang0908@xxxxxxxxx>

New version — new email thread.
Reviewed-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxx>

--
With Best Regards,
Andy Shevchenko