Skip to content

Commit ee25d97

Browse files
rikardfalkebornmripard
authored andcommitted
clk: sunxi: Fix incorrect usage of round_down()
round_down() can only round to powers of 2. If round_down() is asked to round to something that is not a power of 2, incorrect results are produced. The incorrect results can be both too large and too small. Instead, use rounddown() which can round to any number. Fixes: 6a721db ("clk: sunxi: Add A31 clocks support") Signed-off-by: Rikard Falkeborn <[email protected]> Signed-off-by: Maxime Ripard <[email protected]>
1 parent 8f3d9f3 commit ee25d97

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/clk/sunxi/clk-sunxi.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ static void sun6i_a31_get_pll1_factors(struct factors_request *req)
9090
* Round down the frequency to the closest multiple of either
9191
* 6 or 16
9292
*/
93-
u32 round_freq_6 = round_down(freq_mhz, 6);
93+
u32 round_freq_6 = rounddown(freq_mhz, 6);
9494
u32 round_freq_16 = round_down(freq_mhz, 16);
9595

9696
if (round_freq_6 > round_freq_16)

0 commit comments

Comments
 (0)