From: Wentao Liang <vulab@iscas•ac.cn>
To: andrew@lunn•ch, gregory.clement@bootlin•com,
sebastian.hesselbarth@gmail•com, mturquette@baylibre•com,
sboyd@kernel•org
Cc: bmasney@redhat•com, linux-arm-kernel@lists•infradead.org,
linux-clk@vger•kernel.org, linux-kernel@vger•kernel.org,
Wentao Liang <vulab@iscas•ac.cn>,
stable@vger•kernel.org
Subject: [PATCH] clk: mvebu: ap-cpu: fix missing clk_put() in ap_cpu_clock_probe()
Date: Thu, 4 Jun 2026 02:51:15 +0000 [thread overview]
Message-ID: <20260604025115.3763823-1-vulab@iscas.ac.cn> (raw)
The function ap_cpu_clock_probe() calls of_clk_get() to obtain a
reference to the parent clock for each CPU cluster, but it never
releases it with clk_put(). The returned clk is used only to read
the parent's name via __clk_get_name(), and the reference is leaked
on every successful cluster initialization as well as on the error
path when devm_clk_hw_register() fails.
Add the missing clk_put() after the name has been extracted and
before returning on error to fix the leak.
Fixes: af9617b419f7 ("clk: mvebu: ap-cpu-clk: Fix a memory leak in error handling paths")
Cc: stable@vger•kernel.org
Signed-off-by: Wentao Liang <vulab@iscas•ac.cn>
---
drivers/clk/mvebu/ap-cpu-clk.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/clk/mvebu/ap-cpu-clk.c b/drivers/clk/mvebu/ap-cpu-clk.c
index 1e44ace7d951..a8175908e353 100644
--- a/drivers/clk/mvebu/ap-cpu-clk.c
+++ b/drivers/clk/mvebu/ap-cpu-clk.c
@@ -328,9 +328,11 @@ static int ap_cpu_clock_probe(struct platform_device *pdev)
ret = devm_clk_hw_register(dev, &ap_cpu_clk[cluster_index].hw);
if (ret) {
of_node_put(dn);
+ clk_put(parent);
return ret;
}
ap_cpu_data->hws[cluster_index] = &ap_cpu_clk[cluster_index].hw;
+ clk_put(parent);
}
ap_cpu_data->num = cluster_index + 1;
--
2.34.1
next reply other threads:[~2026-06-04 2:51 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-04 2:51 Wentao Liang [this message]
2026-06-04 3:21 ` [PATCH] clk: mvebu: ap-cpu: fix missing clk_put() in ap_cpu_clock_probe() Andrew Lunn
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=20260604025115.3763823-1-vulab@iscas.ac.cn \
--to=vulab@iscas$(echo .)ac.cn \
--cc=andrew@lunn$(echo .)ch \
--cc=bmasney@redhat$(echo .)com \
--cc=gregory.clement@bootlin$(echo .)com \
--cc=linux-arm-kernel@lists$(echo .)infradead.org \
--cc=linux-clk@vger$(echo .)kernel.org \
--cc=linux-kernel@vger$(echo .)kernel.org \
--cc=mturquette@baylibre$(echo .)com \
--cc=sboyd@kernel$(echo .)org \
--cc=sebastian.hesselbarth@gmail$(echo .)com \
--cc=stable@vger$(echo .)kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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