Commit 5469d4f2 authored by Geert Uytterhoeven's avatar Geert Uytterhoeven Committed by Michael Turquette

clk: shmobile: div6: Avoid division by zero in .round_rate()

Anyone may call clk_round_rate() with a zero rate value, so we have to
protect against that.
Signed-off-by: default avatarGeert Uytterhoeven <geert+renesas@glider.be>
Acked-by: default avatarWolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: default avatarMichael Turquette <mturquette@linaro.org>
parent 039e5970
......@@ -90,6 +90,9 @@ static unsigned int cpg_div6_clock_calc_div(unsigned long rate,
{
unsigned int div;
if (!rate)
rate = 1;
div = DIV_ROUND_CLOSEST(parent_rate, rate);
return clamp_t(unsigned int, div, 1, 64);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment