Linux clock framework development
 help / color / mirror / Atom feed
* [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

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