clk: xgene: use div64_u64() instead of do_div()
PATCH 1/1 clk: xgene: 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/clk-xgene.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/clk/clk-xgene.c +2 -2
@@ -262,7 +262,7 @@ static unsigned long xgene_clk_pmd_recalc_rate(struct clk_hw *hw, scale++;/* freq = parent_rate * scaler / denom */ -do_div (ret, fd->denom); +div64_u64 (ret, fd->denom); ret *= scale;if (ret ==0 ) ret = (u64 )parent_rate;
@@ -284,7 +284,7 @@ static long xgene_clk_pmd_round_rate(struct clk_hw *hw, unsigned long rate, scale =DIV_ROUND_UP_ULL (ret, *parent_rate); ret = (u64)*parent_rate * scale; -do_div (ret, fd->denom); +div64_u64 (ret, fd->denom);return ret; }
Signature · 1 line
2.7.4