[PATCH v2] gpio: rockchip: resolve overflow issues

Andy Shevchenko andriy.shevchenko at linux.intel.com
Fri Aug 23 07:48:03 PDT 2024


On Fri, Aug 23, 2024 at 11:43:06AM +0800, Ye Zhang wrote:
> Prevent overflow issues when performing debounce-related calculations.

...

> -		max_debounce = (GENMASK(23, 0) + 1) * 2 * 1000000 / freq;
> +		div = (u64)(GENMASK(23, 0) + 1) * 2 * 1000000;

You probably want to use HZ_PER_MHZ from units.h or so?

-- 
With Best Regards,
Andy Shevchenko





More information about the Linux-rockchip mailing list