OSDN Git Service

powerpc/xics: Add missing of_node_put() in error path
authorYueHaibing <yuehaibing@huawei.com>
Wed, 25 Apr 2018 11:27:07 +0000 (19:27 +0800)
committerMichael Ellerman <mpe@ellerman.id.au>
Sun, 3 Jun 2018 10:43:35 +0000 (20:43 +1000)
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@huawei.com>
[mpe: Invert the sense of the if so we only need one return path]
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
arch/powerpc/sysdev/xics/xics-common.c

index 77e864d..f874703 100644 (file)
@@ -446,10 +446,11 @@ static void __init xics_get_server_size(void)
        np = of_find_compatible_node(NULL, NULL, "ibm,ppc-xics");
        if (!np)
                return;
+
        isize = of_get_property(np, "ibm,interrupt-server#-size", NULL);
-       if (!isize)
-               return;
-       xics_interrupt_server_size = be32_to_cpu(*isize);
+       if (isize)
+               xics_interrupt_server_size = be32_to_cpu(*isize);
+
        of_node_put(np);
 }