Skip to contentSkip to conversation

arch: microblaze: pci: Add missing of_node_put() in xilinx_pci.c

PATCH New Liang He 1 participant 1 message Jun 15, 2022

Subsystems (2)
lore
Share & tools
lore

Liang He

author
#0 lore raw

PATCH 1/1 arch: microblaze: pci: Add missing of_node_put() in xilinx_pci.c

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.

---
 arch/microblaze/pci/xilinx_pci.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
arch/microblaze/pci/xilinx_pci.c +5 -2
index f4cb86fffcee..018d91bdcbb9 100644
@@ -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);
 }
Signature · 1 line
2.25.1