* [PATCH] clk: vt8500: Return the error from vtwm_pll_determine_rate()
@ 2026-12-04 0:59 Weidong Wang via B4 Relay
2026-12-04 1:11 ` sashiko-bot
0 siblings, 1 reply; 2+ messages in thread
From: Weidong Wang via B4 Relay @ 2026-12-04 0:59 UTC (permalink / raw)
To: Stephen Boyd, Brian Masney
Cc: Jerome Brunet, linux-clk, linux-kernel, Weidong Wang
From: Weidong Wang <weidongw@illinois.edu>
When a *_find_pll_bits() helper rejects the requested rate,
vtwm_pll_determine_rate() stores the negative errno in the unsigned
req->rate and returns 0. The clock core then treats the request as
successful and clk_round_rate() reports a bogus rate near ULONG_MAX
instead of an error.
Return the error as the old round_rate() op did, and only set req->rate
on success.
Found by a static analysis tool.
Fixes: ff03cca71ebd ("clk: vt8500: convert from round_rate() to determine_rate()")
Signed-off-by: Weidong Wang <weidongw@illinois.edu>
---
The fix and the changelog were drafted with AI assistance (Claude Code,
with a second review by OpenAI Codex), then reviewed by the submitter.
Testing:
- Compile-tested on x86_64 (allmodconfig, W=1):
drivers/clk/clk-vt8500.o; no new warnings.
- checkpatch.pl --strict: no errors or warnings.
---
drivers/clk/clk-vt8500.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/clk/clk-vt8500.c b/drivers/clk/clk-vt8500.c
index 581ac00c31bc..4624b902f82c 100644
--- a/drivers/clk/clk-vt8500.c
+++ b/drivers/clk/clk-vt8500.c
@@ -637,9 +637,9 @@ static int vtwm_pll_determine_rate(struct clk_hw *hw,
}
if (ret)
- req->rate = ret;
- else
- req->rate = round_rate;
+ return ret;
+
+ req->rate = round_rate;
return 0;
}
---
base-commit: 65cf6d500df204cd5bb487773b26c9221d73a247
change-id: 20261203-kbug-l1923-9d57c5388231
Best regards,
--
Weidong Wang <weidongw@illinois.edu>
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] clk: vt8500: Return the error from vtwm_pll_determine_rate()
2026-12-04 0:59 [PATCH] clk: vt8500: Return the error from vtwm_pll_determine_rate() Weidong Wang via B4 Relay
@ 2026-12-04 1:11 ` sashiko-bot
0 siblings, 0 replies; 2+ messages in thread
From: sashiko-bot @ 2026-12-04 1:11 UTC (permalink / raw)
To: Weidong Wang; +Cc: linux-clk
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] clk: vt8500: commit message misstates clk_round_rate() error
behavior
--
commit 3e95563f4a638d437e597748764ec4139a458886
Author: Weidong Wang <weidongw@illinois.edu>
clk: vt8500: Return the error from vtwm_pll_determine_rate()
This commit changes vtwm_pll_determine_rate() to return the error from
the *_find_pll_bits() helpers instead of assigning it to req->rate and
returning 0.
> When a *_find_pll_bits() helper rejects the requested rate,
> vtwm_pll_determine_rate() stores the negative errno in the unsigned
> req->rate and returns 0. The clock core then treats the request as
> successful and clk_round_rate() reports a bogus rate near ULONG_MAX
> instead of an error.
[Severity: Low]
Does clk_round_rate() actually report a rate near ULONG_MAX here?
clk_round_rate() returns signed long, so converting the negative errno
stored in unsigned long req->rate back to long still yields the negative
errno.
The callers that see a bogus rate near ULONG_MAX or treat the failed
request as successful are clk_hw_round_rate() (which returns unsigned
long) and clk_set_rate() via clk_calc_new_rates(). Updating the commit
message to cite those instead would make the changelog accurate.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261203-kbug-l1923-v1-1-590e67d6beaa@illinois.edu?part=1
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-12-04 1:11 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-04 0:59 [PATCH] clk: vt8500: Return the error from vtwm_pll_determine_rate() Weidong Wang via B4 Relay
2026-12-04 1:11 ` sashiko-bot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox