Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Yuho Choi <oss.patchbox@gmail.com>
To: Nishanth Menon <nm@ti.com>, Santosh Shilimkar <ssantosh@kernel.org>
Cc: Russell King <linux@armlinux.org.uk>,
	Kevin Hilman <khilman@baylibre.com>,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, Yuho Choi <oss.patchbox@gmail.com>
Subject: [PATCH] ARM: keystone: Fix OF node reference leak in keystone_pm_runtime_init()
Date: Tue, 24 Nov 2026 15:46:21 +0000	[thread overview]
Message-ID: <20261124154623.340362-2-oss.patchbox@gmail.com> (raw)

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



                 reply	other threads:[~2026-11-24 16:33 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=20261124154623.340362-2-oss.patchbox@gmail.com \
    --to=oss.patchbox@gmail.com \
    --cc=khilman@baylibre.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=nm@ti.com \
    --cc=ssantosh@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