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 <zhangzeku...@huawei.com>
---
 arch/powerpc/platforms/powermac/pic.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

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")) {
-- 
2.22.0


Reply via email to