Skip to content

Commit b8d1706

Browse files
committed
clk: samsung: pll: Fix possible truncation in a9fraco recalc rate
samsung_a9fraco_recalc_rate(), unlike other functions in the unit, is the first case dividing u64 by u64, thus it should rather use div64_u64 to avoid possible truncation. Note that the original code did not use remainder. This fixes Coccinelle warning: clk-pll.c:1489:1-7: WARNING: do_div() does a 64-by-32 division, please consider using div64_u64 instead. Reported-by: kernel test robot <lkp@intel.com> Closes: https://lore.kernel.org/oe-kbuild-all/202602250053.wEU1hlpY-lkp@intel.com/ Fixes: f051dc5 ("clk: samsung: Add clock PLL support for ARTPEC-9 SoC") Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com> Link: https://patch.msgid.link/20260226205445.336839-3-krzysztof.kozlowski@oss.qualcomm.com Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
1 parent 5e5f328 commit b8d1706

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

drivers/clk/samsung/clk-pll.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1485,7 +1485,7 @@ static unsigned long samsung_a9fraco_recalc_rate(struct clk_hw *hw,
14851485
/* fvco = fref * (M + K/2^24) / p * (S+1) */
14861486
fvco *= mdiv;
14871487
fvco = (fvco << 24) + kdiv;
1488-
do_div(fvco, ((pdiv * (sdiv + 1)) << 24));
1488+
fvco = div64_u64(fvco, ((pdiv * (sdiv + 1)) << 24));
14891489

14901490
return (unsigned long)fvco;
14911491
}

0 commit comments

Comments
 (0)