Devicetree
 help / color / mirror / Atom feed
From: Wentao Liang <vulab@iscas.ac.cn>
To: devicetree@vger.kernel.org
Cc: f.fainelli@gmail.com, frowand.list@gmail.com,
	jim2101024@gmail.com, linux-kernel@vger.kernel.org,
	robh@kernel.org, saravanak@kernel.org,
	Wentao Liang <vulab@iscas.ac.cn>,
	stable@vger.kernel.org
Subject: [PATCH] of: unittest: Fix np reference leak in of_unittest_dma_ranges_one()
Date: Thu, 17 Sep 2026 12:52:38 +0000	[thread overview]
Message-ID: <20260917125238.2152144-1-vulab@iscas.ac.cn> (raw)

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


                 reply	other threads:[~2026-09-17 12:52 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=20260917125238.2152144-1-vulab@iscas.ac.cn \
    --to=vulab@iscas.ac.cn \
    --cc=devicetree@vger.kernel.org \
    --cc=f.fainelli@gmail.com \
    --cc=frowand.list@gmail.com \
    --cc=jim2101024@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=robh@kernel.org \
    --cc=saravanak@kernel.org \
    --cc=stable@vger.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