[PATCH] powerpc/xics: add missing of_node_put() in error path

YueHaibing yuehaibing at huawei.com
Wed Apr 25 21:27:07 AEST 2018


The device node obtained with of_find_compatible_node() should be
released by calling of_node_put().  But it was not released when
of_get_property() failed.

Signed-off-by: YueHaibing <yuehaibing at huawei.com>
---
 arch/powerpc/sysdev/xics/xics-common.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch/powerpc/sysdev/xics/xics-common.c b/arch/powerpc/sysdev/xics/xics-common.c
index 77e864d..e54a9e6 100644
--- a/arch/powerpc/sysdev/xics/xics-common.c
+++ b/arch/powerpc/sysdev/xics/xics-common.c
@@ -448,7 +448,10 @@ static void __init xics_get_server_size(void)
 		return;
 	isize = of_get_property(np, "ibm,interrupt-server#-size", NULL);
 	if (!isize)
+	{
+		of_node_put(np);
 		return;
+	}
 	xics_interrupt_server_size = be32_to_cpu(*isize);
 	of_node_put(np);
 }
-- 
2.7.0




More information about the Linuxppc-dev mailing list