[PATCH] arch: powerpc: add missing of_node_put before break

Qing Wang wangqing at vivo.com
Mon Dec 13 20:42:52 AEDT 2021


From: Wang Qing <wangqing at vivo.com>

Fix following coccicheck warning:
WARNING: Function "for_each_node_by_name" 
should have of_node_put() before return.

Early exits from for_each_node_by_name should decrement the
node reference counter.

Signed-off-by: Wang Qing <wangqing at vivo.com>
---
 arch/powerpc/platforms/powermac/smp.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/platforms/powermac/smp.c b/arch/powerpc/platforms/powermac/smp.c
index 3256a31..c9a044a
--- a/arch/powerpc/platforms/powermac/smp.c
+++ b/arch/powerpc/platforms/powermac/smp.c
@@ -598,8 +598,10 @@ static void __init smp_core99_setup_i2c_hwsync(int ncpus)
 			name = "Pulsar";
 			break;
 		}
-		if (pmac_tb_freeze != NULL)
+		if (pmac_tb_freeze != NULL) {
+			of_node_put(cc);
 			break;
+		}
 	}
 	if (pmac_tb_freeze != NULL) {
 		/* Open i2c bus for synchronous access */
-- 
2.7.4



More information about the Linuxppc-dev mailing list