[PATCH] clocksource/drivers/armv7m_systick: Fix clock reference leak

Wentao Liang vulab at iscas.ac.cn
Mon Sep 14 22:50:43 PDT 2026


system_timer_of_register() obtains the timer clock with of_clk_get()
and enables it, but on the success path the local clock reference is
simply dropped without clk_put(), leaking the consumer reference. The
error labels already release the clock.

Release the reference with clk_put() before returning success. The
clock remains prepared and enabled, so the timer keeps running.

Fixes: 4958ebb3d027 ("clocksource/drivers/armv7m_systick: Add ARM System timer driver")
Cc: stable at vger.kernel.org
Signed-off-by: Wentao Liang <vulab at iscas.ac.cn>
---
 drivers/clocksource/armv7m_systick.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/clocksource/armv7m_systick.c b/drivers/clocksource/armv7m_systick.c
index 7e78074480e4..1810f811bb2a 100644
--- a/drivers/clocksource/armv7m_systick.c
+++ b/drivers/clocksource/armv7m_systick.c
@@ -69,6 +69,9 @@ static int __init system_timer_of_register(struct device_node *np)
 
 	pr_info("ARM System timer initialized as clocksource\n");
 
+	if (clk)
+		clk_put(clk);
+
 	return 0;
 
 out_clk_disable:
-- 
2.34.1




More information about the linux-arm-kernel mailing list