[PATCH 1/2] clk: samsung: pll: Fix possible truncation in a9fraco recalc rate
From: Krzysztof Kozlowski
Date: Thu Feb 26 2026 - 15:57:16 EST
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@xxxxxxxxx>
Closes: https://lore.kernel.org/oe-kbuild-all/202602250053.wEU1hlpY-lkp@xxxxxxxxx/
Fixes: f051dc5bc8e7 ("clk: samsung: Add clock PLL support for ARTPEC-9 SoC")
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@xxxxxxxxxxxxxxxx>
---
drivers/clk/samsung/clk-pll.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/clk/samsung/clk-pll.c b/drivers/clk/samsung/clk-pll.c
index 0d0494927e59..fdb84bcec912 100644
--- a/drivers/clk/samsung/clk-pll.c
+++ b/drivers/clk/samsung/clk-pll.c
@@ -1485,7 +1485,7 @@ static unsigned long samsung_a9fraco_recalc_rate(struct clk_hw *hw,
/* fvco = fref * (M + K/2^24) / p * (S+1) */
fvco *= mdiv;
fvco = (fvco << 24) + kdiv;
- do_div(fvco, ((pdiv * (sdiv + 1)) << 24));
+ fvco = div64_u64(fvco, ((pdiv * (sdiv + 1)) << 24));
return (unsigned long)fvco;
}
--
2.51.0