From: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
To: Krzysztof Kozlowski <krzk@kernel.org>,
Sylwester Nawrocki <s.nawrocki@samsung.com>,
Chanwoo Choi <cw00.choi@samsung.com>,
Alim Akhtar <alim.akhtar@samsung.com>,
Michael Turquette <mturquette@baylibre.com>,
Stephen Boyd <sboyd@kernel.org>,
GyoungBo Min <mingyoungbo@coasia.com>,
Kyunghwan Kim <kenkim@coasia.com>,
Ravi Patel <ravi.patel@samsung.com>,
linux-samsung-soc@vger.kernel.org, linux-clk@vger.kernel.org,
linux-kernel@vger.kernel.org
Cc: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>,
kernel test robot <lkp@intel.com>
Subject: [PATCH 1/2] clk: samsung: pll: Fix possible truncation in a9fraco recalc rate
Date: Thu, 26 Feb 2026 21:54:46 +0100 [thread overview]
Message-ID: <20260226205445.336839-3-krzysztof.kozlowski@oss.qualcomm.com> (raw)
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: f051dc5bc8e7 ("clk: samsung: Add clock PLL support for ARTPEC-9 SoC")
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
---
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
next reply other threads:[~2026-02-26 20:54 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-26 20:54 Krzysztof Kozlowski [this message]
2026-02-26 20:54 ` [PATCH 2/2] clk: samsung: Use %pe format to simplify Krzysztof Kozlowski
2026-03-02 17:08 ` Brian Masney
2026-02-28 14:58 ` [PATCH 1/2] clk: samsung: pll: Fix possible truncation in a9fraco recalc rate Krzysztof Kozlowski
2026-03-02 17:07 ` Brian Masney
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260226205445.336839-3-krzysztof.kozlowski@oss.qualcomm.com \
--to=krzysztof.kozlowski@oss.qualcomm.com \
--cc=alim.akhtar@samsung.com \
--cc=cw00.choi@samsung.com \
--cc=kenkim@coasia.com \
--cc=krzk@kernel.org \
--cc=linux-clk@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-samsung-soc@vger.kernel.org \
--cc=lkp@intel.com \
--cc=mingyoungbo@coasia.com \
--cc=mturquette@baylibre.com \
--cc=ravi.patel@samsung.com \
--cc=s.nawrocki@samsung.com \
--cc=sboyd@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).