From: Yuho Choi <oss.patchbox@gmail.com>
To: Sudeep Holla <sudeep.holla@kernel.org>,
Liviu Dudau <liviu.dudau@arm.com>,
Lorenzo Pieralisi <lpieralisi@kernel.org>,
Linus Walleij <linusw@kernel.org>
Cc: Russell King <linux@armlinux.org.uk>,
Nicolas Pitre <nico@fluxnic.net>,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, Yuho Choi <oss.patchbox@gmail.com>
Subject: [PATCH] ARM: vexpress: Fix device_node reference leak in tc2_pm_init()
Date: Tue, 24 Nov 2026 15:37:35 +0000 [thread overview]
Message-ID: <20261124153755.338370-2-oss.patchbox@gmail.com> (raw)
tc2_pm_init() looks up the SCC node with of_find_compatible_node(),
which returns the node with its reference count raised, and passes it
to of_iomap() and irq_of_parse_and_map(). Neither of them keeps the
node, and none of the function's exits drops the reference.
tc2_pm_init() runs once as an early initcall, so this leaks a single
reference at boot.
Declare np with __free(device_node) so that the reference is dropped
when the function returns, as is already done in vexpress_flags_set()
and vexpress_smp_dt_prepare_cpus().
Fixes: 11b277eabe70 ("ARM: vexpress/TC2: basic PM support")
Signed-off-by: Yuho Choi <oss.patchbox@gmail.com>
---
Compile-tested only (ARM multi_v7_defconfig, W=1). I have no TC2 board
to test it on.
arch/arm/mach-versatile/tc2_pm.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/arch/arm/mach-versatile/tc2_pm.c b/arch/arm/mach-versatile/tc2_pm.c
index 0fe78da0c109..0e471a76bc98 100644
--- a/arch/arm/mach-versatile/tc2_pm.c
+++ b/arch/arm/mach-versatile/tc2_pm.c
@@ -202,15 +202,15 @@ static int __init tc2_pm_init(void)
unsigned int mpidr, cpu, cluster;
int ret, irq;
u32 a15_cluster_id, a7_cluster_id, sys_info;
- struct device_node *np;
/*
* The power management-related features are hidden behind
* SCC registers. We need to extract runtime information like
* cluster ids and number of CPUs really available in clusters.
*/
- np = of_find_compatible_node(NULL, NULL,
- "arm,vexpress-scc,v2p-ca15_a7");
+ struct device_node *np __free(device_node) =
+ of_find_compatible_node(NULL, NULL,
+ "arm,vexpress-scc,v2p-ca15_a7");
scc = of_iomap(np, 0);
if (!scc)
return -ENODEV;
base-commit: 8dac6df92a2e66e2098bbc69061964cfe7e8375b
--
2.56.1
reply other threads:[~2026-11-24 15:38 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=20261124153755.338370-2-oss.patchbox@gmail.com \
--to=oss.patchbox@gmail.com \
--cc=linusw@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=liviu.dudau@arm.com \
--cc=lpieralisi@kernel.org \
--cc=nico@fluxnic.net \
--cc=sudeep.holla@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