mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Liang He <windhl@126.com>
To: monstr@monstr.eu, wangxiang@cdjrlc.com
Cc: linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, windhl@126.com
Subject: [PATCH] arch: microblaze: pci: Add missing of_node_put() in xilinx_pci.c
Date: Wed, 15 Jun 2022 21:03:26 +0800	[thread overview]
Message-ID: <20220615130326.3966842-1-windhl@126.com> (raw)

In xilinx_pci_init(), of_find_matching_node() will return a node
pointer with refcount incremented. We should use of_node_put() in
fail path or when it is not used anymore.

Signed-off-by: Liang He <windhl@126.com>
---
 arch/microblaze/pci/xilinx_pci.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/arch/microblaze/pci/xilinx_pci.c b/arch/microblaze/pci/xilinx_pci.c
index f4cb86fffcee..018d91bdcbb9 100644
--- a/arch/microblaze/pci/xilinx_pci.c
+++ b/arch/microblaze/pci/xilinx_pci.c
@@ -132,13 +132,13 @@ void __init xilinx_pci_init(void)
 
 	if (of_address_to_resource(pci_node, 0, &r)) {
 		pr_err("xilinx-pci: cannot resolve base address\n");
-		return;
+		goto out_put;
 	}
 
 	hose = pcibios_alloc_controller(pci_node);
 	if (!hose) {
 		pr_err("xilinx-pci: pcibios_alloc_controller() failed\n");
-		return;
+		goto out_put;
 	}
 
 	/* Setup config space */
@@ -167,4 +167,7 @@ void __init xilinx_pci_init(void)
 
 	pr_info("xilinx-pci: Registered PCI host bridge\n");
 	xilinx_early_pci_scan(hose);
+	
+out_put:
+	of_node_put(pci_node);
 }
-- 
2.25.1


                 reply	other threads:[~2022-06-15 13:04 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=20220615130326.3966842-1-windhl@126.com \
    --to=windhl@126.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=monstr@monstr.eu \
    --cc=wangxiang@cdjrlc.com \
    /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

all inboxes | Powered by JetHome®