linux-mips.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Miaoqian Lin <linmq006@gmail.com>
To: Thomas Bogendoerfer <tsbogend@alpha.franken.de>,
	Miaoqian Lin <linmq006@gmail.com>,
	Geert Uytterhoeven <geert+renesas@glider.be>,
	Miodrag Dinic <miodrag.dinic@mips.com>,
	James Hogan <jhogan@kernel.org>,
	Paul Burton <paulburton@kernel.org>,
	Aleksandar Markovic <aleksandar.markovic@mips.com>,
	linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] MIPS: CPC: Fix refcount leak in mips_cpc_default_phys_base
Date: Mon, 16 May 2022 08:33:50 +0400	[thread overview]
Message-ID: <20220516043353.8147-1-linmq006@gmail.com> (raw)

of_find_compatible_node() returns a node pointer with refcount
incremented, we should use of_node_put() on it when done.
Add missing of_node_put() to avoid refcount leak.

Fixes: 791412dafbbf ("MIPS: CPC: Map registers using DT in mips_cpc_default_phys_base()")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
---
 arch/mips/kernel/mips-cpc.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/mips/kernel/mips-cpc.c b/arch/mips/kernel/mips-cpc.c
index 17aff13cd7ce..3e386f7e1545 100644
--- a/arch/mips/kernel/mips-cpc.c
+++ b/arch/mips/kernel/mips-cpc.c
@@ -28,6 +28,7 @@ phys_addr_t __weak mips_cpc_default_phys_base(void)
 	cpc_node = of_find_compatible_node(of_root, NULL, "mti,mips-cpc");
 	if (cpc_node) {
 		err = of_address_to_resource(cpc_node, 0, &res);
+		of_node_put(cpc_node);
 		if (!err)
 			return res.start;
 	}
-- 
2.25.1


             reply	other threads:[~2022-05-16  4:34 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-16  4:33 Miaoqian Lin [this message]
2022-05-23  9:18 ` [PATCH] MIPS: CPC: Fix refcount leak in mips_cpc_default_phys_base Thomas Bogendoerfer
2022-05-23 13:16 ` Serge Semin

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=20220516043353.8147-1-linmq006@gmail.com \
    --to=linmq006@gmail.com \
    --cc=aleksandar.markovic@mips.com \
    --cc=geert+renesas@glider.be \
    --cc=jhogan@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@vger.kernel.org \
    --cc=miodrag.dinic@mips.com \
    --cc=paulburton@kernel.org \
    --cc=tsbogend@alpha.franken.de \
    /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;
as well as URLs for NNTP newsgroup(s).