* [PATCH] clk: rockchip: Skip PLL lock wait when GRF regmap is unavailable
@ 2026-12-05 6:40 Praneeth Balasubramanian
[not found] ` <sashiko-outbox-251172@kernel.org>
0 siblings, 1 reply; 2+ messages in thread
From: Praneeth Balasubramanian @ 2026-12-05 6:40 UTC (permalink / raw)
To: Stephen Boyd, Brian Masney, Jerome Brunet, Heiko Stuebner
Cc: Praneeth Balasubramanian, stable, linux-clk, linux-arm-kernel,
linux-rockchip, linux-kernel
When the DT node for a CRU has no rockchip,grf phandle,
syscon_regmap_lookup_by_phandle() stores an error pointer in ctx->grf.
For rk3066-type PLLs the registration code then selects the no-rate ops.
Those ops still install the .enable callback. rockchip_pll_enable()
calls rockchip_pll_wait_lock(), which passes the error pointer to
regmap_read_poll_timeout().
The only way to reach this state is a DT error, so the harm is limited
to robustness against a broken DT. Add an IS_ERR() check on the GRF
regmap in rockchip_pll_wait_lock() and return 0 when it is missing.
Without the GRF the lock bit cannot be polled, so the PLL is assumed to
lock after the powerdown bit is cleared. The set_rate path that also
uses the GRF is already excluded by the ops selection.
This was found by an LLM-based audit that checks code against the rules
stated in kernel comments.
Fixes: 90c590254051 ("clk: rockchip: add clock type for pll clocks and pll used on rk3066")
Cc: stable@vger.kernel.org
Signed-off-by: Praneeth Balasubramanian <praneethb2002@gmail.com>
---
Notes:
This was found by an LLM-based audit, part of research at UCSB SecLab.
An LLM turned a kernel comment into a rule, and three LLM votes checked
the code against it. The fix and changelog were drafted with GLM-5.3 and
checked against the source with Claude Opus 5.5. I reviewed the patch
and take responsibility for it.
Testing: builds without new warnings with W=1 (x86_64 allmodconfig),
clang 23. checkpatch.pl is clean. Not runtime-tested, and there is no
reproducer. I do not have this hardware.
drivers/clk/rockchip/clk-pll.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/clk/rockchip/clk-pll.c b/drivers/clk/rockchip/clk-pll.c
index d371c66800df..88bced1915e6 100644
--- a/drivers/clk/rockchip/clk-pll.c
+++ b/drivers/clk/rockchip/clk-pll.c
@@ -95,6 +95,9 @@ static int rockchip_pll_wait_lock(struct rockchip_clk_pll *pll)
unsigned int val;
int ret;
+ if (IS_ERR(grf))
+ return 0;
+
ret = regmap_read_poll_timeout(grf, pll->lock_offset, val,
val & BIT(pll->lock_shift), 0, 1000);
if (ret)
base-commit: 29beb21c21ada7207692b2d69fc58dcd15dab6e9
--
2.25.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-12-05 8:21 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-05 6:40 [PATCH] clk: rockchip: Skip PLL lock wait when GRF regmap is unavailable Praneeth Balasubramanian
[not found] ` <sashiko-outbox-251172@kernel.org>
2026-12-05 8:21 ` Praneeth Balasubramanian
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox