clk: hisilicon: use div64_u64() instead of do_div()
PATCH 1/1 clk: hisilicon: use div64_u64() instead of do_div()
From: Wang Qing <[email protected]>
do_div() does a 64-by-32 division.
When the divisor is u64, do_div() truncates it to 32 bits, this means it can test non-zero and be truncated to zero for division.
fix do_div.cocci warning:do_div() does a 64-by-32 division, please consider using div64_u64 instead.
Signed-off-by Wang Qing <[email protected]>
--- drivers/clk/hisilicon/clk-hi3559a.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/clk/hisilicon/clk-hi3559a.c +2 -2
@@ -441,8 +441,8 @@ static unsigned long clk_pll_recalc_rate(struct clk_hw *hw, rate =0 ; tmp =24000000 * fbdiv_val + (24000000 * frac_val) / (1 <<24 ); rate += tmp; -do_div (rate, refdiv_val); -do_div (rate, postdiv1_val * postdiv2_val); +div64_u64 (rate, refdiv_val); +div64_u64 (rate, postdiv1_val * postdiv2_val);return rate; }
Signature · 1 line
2.7.4