[PATCH] powerpc/chrp: Add missing of_node_get() before of_find_node_by_name()

Zhang Zekun zhangzekun11 at huawei.com
Thu Oct 24 14:08:17 AEDT 2024


of_find_node_by_name() will decrease the refount of the device_node.
So, get the device_node before passing to it.

Signed-off-by: Zhang Zekun <zhangzekun11 at huawei.com>
---
 arch/powerpc/platforms/chrp/pci.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/powerpc/platforms/chrp/pci.c b/arch/powerpc/platforms/chrp/pci.c
index 428fd2a7b3ee..57dd0f19ada5 100644
--- a/arch/powerpc/platforms/chrp/pci.c
+++ b/arch/powerpc/platforms/chrp/pci.c
@@ -191,6 +191,7 @@ static void __init setup_peg2(struct pci_controller *hose, struct device_node *d
 	struct device_node *root = of_find_node_by_path("/");
 	struct device_node *rtas;
 
+	of_node_get(root);
 	rtas = of_find_node_by_name (root, "rtas");
 	if (rtas) {
 		hose->ops = &rtas_pci_ops;
-- 
2.17.1



More information about the Linuxppc-dev mailing list