From: Wang Qing <wangqing@xxxxxxxx> Fix following coccicheck warning: WARNING: Function "for_each_node_by_type" should have of_node_put() before return. Early exits from for_each_node_by_type should decrement the node reference counter. Signed-off-by: Wang Qing <wangqing@xxxxxxxx> --- arch/sparc/kernel/prom_64.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/arch/sparc/kernel/prom_64.c b/arch/sparc/kernel/prom_64.c index f883a50..ed3e987 --- a/arch/sparc/kernel/prom_64.c +++ b/arch/sparc/kernel/prom_64.c @@ -460,8 +460,10 @@ static void *of_iterate_over_cpus(void *(*func)(struct device_node *, int, int), } #endif ret = func(dp, cpuid, arg); - if (ret) + if (ret) { + of_node_put(dp); return ret; + } } return NULL; } -- 2.7.4