[PATCH v2] gpio: rockchip: avoid division by zero
Andy Shevchenko
andriy.shevchenko at linux.intel.com
Fri Aug 23 07:45:54 PDT 2024
On Fri, Aug 23, 2024 at 11:43:04AM +0800, Ye Zhang wrote:
> If the clk_get_rate return '0', it will happen division by zero.
At the abstraction level this is good to avoid 0 division and return an error,
but...
> freq = clk_get_rate(bank->db_clk);
> + if (!freq)
> + return -EINVAL;
...do you this the absence of debounce here is a fatal error?
(Yes, I see it's a fatal when it's bigger than maximum.)
> max_debounce = (GENMASK(23, 0) + 1) * 2 * 1000000 / freq;
> if (debounce > max_debounce)
> return -EINVAL;
--
With Best Regards,
Andy Shevchenko
More information about the Linux-rockchip
mailing list