mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] of: unittest: Fix np reference leak in of_unittest_printf()
@ 2026-09-17 13:08 Wentao Liang
  0 siblings, 0 replies; only message in thread
From: Wentao Liang @ 2026-09-17 13:08 UTC (permalink / raw)
  To: devicetree
  Cc: joe, linux-kernel, pantelis.antoniou, robh, saravanak,
	Wentao Liang, stable

of_find_node_by_path() returns a node with an elevated reference count,
but the function returns without ever dropping it. Add the missing
of_node_put() so the reference is not leaked.

Fixes: ce4fecf1fe15 ("vsprintf: Add %p extension "%pOF" for device tree")
Cc: stable@vger.kernel.org
Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
---
 drivers/of/unittest.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/of/unittest.c b/drivers/of/unittest.c
index e6e938bcb100..340e23725d7a 100644
--- a/drivers/of/unittest.c
+++ b/drivers/of/unittest.c
@@ -354,6 +354,8 @@ static void __init of_unittest_printf(void)
 	of_unittest_printf_one(np, "%pOFc", "test-sub-device");
 	of_unittest_printf_one(np, "%pOFC",
 			"\"test-sub-device\",\"test-compat2\",\"test-compat3\"");
+
+	of_node_put(np);
 }
 
 struct node_hash {
-- 
2.34.1


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

only message in thread, other threads:[~2026-09-17 13:08 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-17 13:08 [PATCH] of: unittest: Fix np reference leak in of_unittest_printf() Wentao Liang

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®