* [PATCH] rtc: hym8563: Fix potential stale clock after device removal
@ 2026-11-10 14:32 Guangshuo Li
2026-11-10 14:37 ` sashiko-bot
0 siblings, 1 reply; 2+ messages in thread
From: Guangshuo Li @ 2026-11-10 14:32 UTC (permalink / raw)
To: Alexandre Belloni; +Cc: linux-rtc, linux-kernel, stable
The CLKOUT clock and its provider are registered without a matching
unregister operation. Removal or a later probe failure releases the
HYM8563 private data containing the clock hardware while the clock is
still registered.
Manage both registrations with the device so the provider is removed
before the clock, and both are removed before their backing storage.
This issue was found by our static analysis tool under development.
Fixes: dcaf03849352 ("rtc: add hym8563 rtc-driver")
Cc: stable@vger.kernel.org
Signed-off-by: Guangshuo Li <liguangshuo@mail.sdu.edu.cn>
---
drivers/rtc/rtc-hym8563.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/rtc/rtc-hym8563.c b/drivers/rtc/rtc-hym8563.c
index e3d7ca477e75..8a4ba4e6fcb4 100644
--- a/drivers/rtc/rtc-hym8563.c
+++ b/drivers/rtc/rtc-hym8563.c
@@ -396,10 +396,11 @@ static struct clk *hym8563_clkout_register_clk(struct hym8563 *hym8563)
of_property_read_string(node, "clock-output-names", &init.name);
/* register the clock */
- clk = clk_register(&client->dev, &hym8563->clkout_hw);
+ clk = devm_clk_register(&client->dev, &hym8563->clkout_hw);
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,
+ &hym8563->clkout_hw);
return clk;
}
base-commit: 6628e7d4c6b25c8d18f1345e3a20d21829aae7e4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] rtc: hym8563: Fix potential stale clock after device removal
2026-11-10 14:32 [PATCH] rtc: hym8563: Fix potential stale clock after device removal Guangshuo Li
@ 2026-11-10 14:37 ` sashiko-bot
0 siblings, 0 replies; 2+ messages in thread
From: sashiko-bot @ 2026-11-10 14:37 UTC (permalink / raw)
To: Guangshuo Li; +Cc: linux-rtc, Alexandre Belloni
> The CLKOUT clock and its provider are registered without a matching
> unregister operation. Removal or a later probe failure releases the
> HYM8563 private data containing the clock hardware while the clock is
> still registered.
>
> Manage both registrations with the device so the provider is removed
> before the clock, and both are removed before their backing storage.
>
> This issue was found by our static analysis tool under development.
>
> Fixes: dcaf03849352 ("rtc: add hym8563 rtc-driver")
> Cc: stable@vger.kernel.org
> Signed-off-by: Guangshuo Li <liguangshuo@mail.sdu.edu.cn>
Sashiko has reviewed this patch and found no issues.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261110-9f141e6bc8-rtc-hym8563@mail.sdu.edu.cn?part=1
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-11-10 14:37 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-10 14:32 [PATCH] rtc: hym8563: Fix potential stale clock after device removal Guangshuo Li
2026-11-10 14:37 ` sashiko-bot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox