diff mbox series

powerpc/chrp: Add missing of_node_get() before of_find_node_by_name()

Message ID 20241024030817.126484-1-zhangzekun11@huawei.com (mailing list archive)
State New
Headers show
Series powerpc/chrp: Add missing of_node_get() before of_find_node_by_name() | expand

Commit Message

Zhang Zekun Oct. 24, 2024, 3:08 a.m. UTC
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@huawei.com>
---
 arch/powerpc/platforms/chrp/pci.c | 1 +
 1 file changed, 1 insertion(+)
diff mbox series

Patch

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;