* [PATCH] rtc: m41t80: Fix potential stale square-wave clock on removal
@ 2026-12-01 12:28 Guangshuo Li
2026-12-01 12:33 ` sashiko-bot
0 siblings, 1 reply; 2+ messages in thread
From: Guangshuo Li @ 2026-12-01 12:28 UTC (permalink / raw)
To: alexandre.belloni; +Cc: gary.bisson, linux-rtc
The square-wave clock and its OF provider remain registered after probe
failure or device removal releases the managed clock data. Subsequent
clock operations can access that freed storage.
Manage both registrations so the provider and clock are removed before
their backing data is released.
This issue was found by our static analysis tool under development.
Fixes: 1373e77b4f10 ("rtc: m41t80: add clock provider support")
Signed-off-by: Guangshuo Li <liguangshuo@mail.sdu.edu.cn>
---
drivers/rtc/rtc-m41t80.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/rtc/rtc-m41t80.c b/drivers/rtc/rtc-m41t80.c
index cfab27aaa518..5f8d6dcdeb5b 100644
--- a/drivers/rtc/rtc-m41t80.c
+++ b/drivers/rtc/rtc-m41t80.c
@@ -604,9 +604,10 @@ static struct clk *m41t80_sqw_register_clk(struct m41t80_data *m41t80)
of_property_read_string(node, "clock-output-names", &init.name);
/* register the clock */
- clk = clk_register(&client->dev, &m41t80->sqw);
+ clk = devm_clk_register(&client->dev, &m41t80->sqw);
if (!IS_ERR(clk))
- of_clk_add_provider(node, of_clk_src_simple_get, clk);
+ devm_of_clk_add_hw_provider(&client->dev, of_clk_hw_simple_get,
+ &m41t80->sqw);
return clk;
}
base-commit: fe6ff8d5d675c01793b9f051d16055dd4aa75244
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-12-01 12:33 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-01 12:28 [PATCH] rtc: m41t80: Fix potential stale square-wave clock on removal Guangshuo Li
2026-12-01 12:33 ` sashiko-bot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox