Devicetree
 help / color / mirror / Atom feed
* [PATCH] of: unittest: Fix np reference leak in of_unittest_dma_ranges_one()
@ 2026-09-17 12:52 Wentao Liang
  0 siblings, 0 replies; only message in thread
From: Wentao Liang @ 2026-09-17 12:52 UTC (permalink / raw)
  To: devicetree
  Cc: f.fainelli, frowand.list, jim2101024, linux-kernel, robh,
	saravanak, Wentao Liang, stable

When the bogus device allocation fails the function returns early and
never drops the reference obtained from of_find_node_by_path(). Add the
missing of_node_put() so the node reference is not leaked.

Fixes: a8d61a9112ad ("of: unittest: fix warning on PowerPC frame size warning")
Cc: stable@vger.kernel.org
Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
---
 drivers/of/unittest.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/of/unittest.c b/drivers/of/unittest.c
index d1a88a043300..226debdaa5c1 100644
--- a/drivers/of/unittest.c
+++ b/drivers/of/unittest.c
@@ -1141,6 +1141,7 @@ static void __init of_unittest_dma_ranges_one(const char *path,
 		if (!dev_bogus) {
 			unittest(0, "kzalloc() failed\n");
 			kfree(map);
+			of_node_put(np);
 			return;
 		}
 
-- 
2.34.1


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

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

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox