Skip to contentSkip to conversation

powerpc: sysdev: Fix refcount leak bug in fsl_pci.c

PATCH New Liang He 1 participant 1 message Jun 18, 2022 PowerPC

lore
Share & tools
lore

Liang He

author
#0 lore raw

PATCH 1/1 powerpc: sysdev: Fix refcount leak bug in fsl_pci.c

In is_kdump(), we need a of_node_put() to dec the refcount which is incremented by of_find_node_by_type().

---
 arch/powerpc/sysdev/fsl_pci.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
arch/powerpc/sysdev/fsl_pci.c +5 -1
index 1011cfea2e32..4c986c955951 100644
@@ -180,6 +180,7 @@ static int setup_one_atmu(struct ccsr_pci __iomem *pci,
 static bool is_kdump(void)
 {
 	struct device_node *node;
+	bool ret;
 
 	node = of_find_node_by_type(NULL, "memory");
 	if (!node) {
@@ -187,7 +188,10 @@ static bool is_kdump(void)
 		return false;
 	}
 
-	return of_property_read_bool(node, "linux,usable-memory");
+	ret = of_property_read_bool(node, "linux,usable-memory");
+	of_node_put(node);
+
+	return ret;
 }
 
 /* atmu setup for fsl pci/pcie controller */
Signature · 1 line
2.25.1