mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] ARM: keystone: Fix OF node reference leak in keystone_pm_runtime_init()
@ 2026-11-24 15:46 Yuho Choi
  0 siblings, 0 replies; only message in thread
From: Yuho Choi @ 2026-11-24 15:46 UTC (permalink / raw)
  To: Nishanth Menon, Santosh Shilimkar
  Cc: Russell King, Kevin Hilman, linux-arm-kernel, linux-kernel, Yuho Choi

keystone_pm_runtime_init() calls of_find_matching_node() only to check
whether it runs on a K2HK, K2E or K2L SoC. The node it finds is
returned with its reference count raised, but the function only tests
the pointer and never drops that reference. keystone_init() calls it
once at boot, so a single reference is leaked.

The compatibles in of_keystone_table are only used on the root node,
so use of_machine_device_match(), which checks the root node without
leaving a reference behind.

Fixes: 8620d2c536dc ("ARM: keystone: fix PM domain initcall to be keystone only")
Signed-off-by: Yuho Choi <oss.patchbox@gmail.com>
---
Compile-tested only (ARM multi_v7_defconfig, W=1). I have no Keystone
board to test it on. All uses of the "ti,k2hk", "ti,k2e" and "ti,k2l"
compatibles in arch/arm/boot/dts are on the root node.

 arch/arm/mach-keystone/keystone.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/arch/arm/mach-keystone/keystone.c b/arch/arm/mach-keystone/keystone.c
index f63671a3024c..4e1f02a73887 100644
--- a/arch/arm/mach-keystone/keystone.c
+++ b/arch/arm/mach-keystone/keystone.c
@@ -53,10 +53,7 @@ static const struct of_device_id of_keystone_table[] = {
 
 static int __init keystone_pm_runtime_init(void)
 {
-	struct device_node *np;
-
-	np = of_find_matching_node(NULL, of_keystone_table);
-	if (!np)
+	if (!of_machine_device_match(of_keystone_table))
 		return 0;
 
 	pm_clk_add_notifier(&platform_bus_type, &platform_domain_notifier);

base-commit: 8dac6df92a2e66e2098bbc69061964cfe7e8375b
-- 
2.56.1


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-11-24 15:46 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-24 15:46 [PATCH] ARM: keystone: Fix OF node reference leak in keystone_pm_runtime_init() Yuho Choi

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®