From: Guangshuo Li <liguangshuo@mail.sdu.edu.cn>
To: Alexandre Belloni <alexandre.belloni@bootlin.com>
Cc: linux-rtc@vger.kernel.org, linux-kernel@vger.kernel.org,
stable@vger.kernel.org
Subject: [PATCH] rtc: hym8563: Fix potential stale clock after device removal
Date: Tue, 10 Nov 2026 22:32:28 +0800 [thread overview]
Message-ID: <20261110-9f141e6bc8-rtc-hym8563@mail.sdu.edu.cn> (raw)
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
reply other threads:[~2026-11-10 14:32 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261110-9f141e6bc8-rtc-hym8563@mail.sdu.edu.cn \
--to=liguangshuo@mail.sdu.edu.cn \
--cc=alexandre.belloni@bootlin.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rtc@vger.kernel.org \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®