diff mbox series

[5/9] powerpc: Use of_find_node_by_name_balanced() to find device_node

Message ID 20250207013117.104205-6-zhangzekun11@huawei.com
State New
Headers show
Series [1/9] of: Add warpper function of_find_node_by_name_balanced() | expand

Commit Message

Zhang Zekun Feb. 7, 2025, 1:31 a.m. UTC
Instead of directly using of_node_get() before of_find_node_by_name()
to balance the refcount of the device_node, using wraper function
of_find_node_by_name_balanced() to make code logic a bit simplier.

Signed-off-by: Zhang Zekun <zhangzekun11@huawei.com>
---
 arch/powerpc/platforms/powermac/pic.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/arch/powerpc/platforms/powermac/pic.c b/arch/powerpc/platforms/powermac/pic.c
index 2202bf77c7a3..0619334adf2a 100644
--- a/arch/powerpc/platforms/powermac/pic.c
+++ b/arch/powerpc/platforms/powermac/pic.c
@@ -308,9 +308,7 @@  static void __init pmac_pic_probe_oldstyle(void)
 
 		/* We might have a second cascaded heathrow */
 
-		/* Compensate for of_node_put() in of_find_node_by_name() */
-		of_node_get(master);
-		slave = of_find_node_by_name(master, "mac-io");
+		slave = of_find_node_by_name_balanced(master, "mac-io");
 
 		/* Check ordering of master & slave */
 		if (of_device_is_compatible(master, "gatwick")) {