* [PATCH] clk: milbeaut: Return divider update timeouts
@ 2026-09-06 3:39 Pengpeng Hou
2026-09-17 15:07 ` Brian Masney
0 siblings, 1 reply; 2+ messages in thread
From: Pengpeng Hou @ 2026-09-06 3:39 UTC (permalink / raw)
To: Stephen Boyd
Cc: Pengpeng Hou, Brian Masney, Jerome Brunet, Taichi Sugaya,
Takao Orito, linux-clk, linux-arm-kernel, linux-kernel
m10v_clk_divider_set_rate() logs when the hardware does not clear its
write-valid request, but still returns success to the clock framework. It
also uses the sleeping poll helper while holding the divider spinlock.
Use the atomic poll helper under the lock and return its timeout so the
rate change is not reported as successful before the hardware accepts it.
The issue was found by our static-analysis tool and manually reviewed.
Fixes: 6a6ba5b55a72 ("clock: milbeaut: Add Milbeaut M10V clock controller")
Assisted-by: gpt 5
Signed-off-by: Pengpeng Hou <hppiscas@163.com>
---
drivers/clk/clk-milbeaut.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/drivers/clk/clk-milbeaut.c b/drivers/clk/clk-milbeaut.c
index 4265bc442dfd..b3bf569ef747 100644
--- a/drivers/clk/clk-milbeaut.c
+++ b/drivers/clk/clk-milbeaut.c
@@ -410,8 +410,8 @@ static int m10v_clk_divider_set_rate(struct clk_hw *hw, unsigned long rate,
unsigned long parent_rate)
{
struct m10v_clk_divider *divider = to_m10v_div(hw);
- int value;
unsigned long flags = 0;
+ int value, ret = 0;
u32 val;
u32 write_en = BIT(divider->width - 1);
@@ -433,8 +433,10 @@ static int m10v_clk_divider_set_rate(struct clk_hw *hw, unsigned long rate,
if (divider->write_valid_reg) {
writel(M10V_DCHREQ, divider->write_valid_reg);
- if (readl_poll_timeout(divider->write_valid_reg, val,
- !val, M10V_UPOLL_RATE, M10V_UTIMEOUT))
+ ret = readl_poll_timeout_atomic(divider->write_valid_reg, val,
+ !val, M10V_UPOLL_RATE,
+ M10V_UTIMEOUT);
+ if (ret)
pr_err("%s:%s couldn't stabilize\n",
__func__, clk_hw_get_name(hw));
}
@@ -444,7 +446,7 @@ static int m10v_clk_divider_set_rate(struct clk_hw *hw, unsigned long rate,
else
__release(divider->lock);
- return 0;
+ return ret;
}
static const struct clk_ops m10v_clk_divider_ops = {
--
2.50.1 (Apple Git-155)
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] clk: milbeaut: Return divider update timeouts
2026-09-06 3:39 [PATCH] clk: milbeaut: Return divider update timeouts Pengpeng Hou
@ 2026-09-17 15:07 ` Brian Masney
0 siblings, 0 replies; 2+ messages in thread
From: Brian Masney @ 2026-09-17 15:07 UTC (permalink / raw)
To: Stephen Boyd, Pengpeng Hou
Cc: Brian Masney, Jerome Brunet, Taichi Sugaya, Takao Orito,
linux-clk, linux-arm-kernel, linux-kernel
On Sun, 06 Sep 2026 11:39:24 +0800, Pengpeng Hou wrote:
> clk: milbeaut: Return divider update timeouts
Applied, thanks!
[1/1] clk: milbeaut: Return divider update timeouts
commit: 526066a4bd5658962800fa64bd3e5432e1f7f92b
Best regards,
--
Brian Masney <bmasney@redhat.com>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-09-17 15:07 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-06 3:39 [PATCH] clk: milbeaut: Return divider update timeouts Pengpeng Hou
2026-09-17 15:07 ` Brian Masney
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®