ARM: uniphier: correct the call order of of_node_put()
authorMasahiro Yamada <yamada.masahiro@socionext.com>
Fri, 15 Apr 2016 10:48:29 +0000 (19:48 +0900)
committerArnd Bergmann <arnd@arndb.de>
Mon, 25 Apr 2016 22:12:22 +0000 (00:12 +0200)
Put nodes after of_address_to_resource() in case the nodes might be
released while parsing in them.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
arch/arm/mach-uniphier/platsmp.c

index 69141357afe81991595f81348df9f2f0964db06f..8693b7c15d592ed2da9dfaddd3b5c8ca61a208da 100644 (file)
@@ -99,16 +99,16 @@ static int __init uniphier_smp_prepare_trampoline(unsigned int max_cpus)
        int ret;
 
        np = of_find_compatible_node(NULL, NULL, "socionext,uniphier-smpctrl");
-       of_node_put(np);
        ret = of_address_to_resource(np, 0, &res);
+       of_node_put(np);
        if (!ret) {
                rom_rsv2_phys = res.start + UNIPHIER_SMPCTRL_ROM_RSV2;
        } else {
                /* try old binding too */
                np = of_find_compatible_node(NULL, NULL,
                                             "socionext,uniphier-system-bus-controller");
-               of_node_put(np);
                ret = of_address_to_resource(np, 1, &res);
+               of_node_put(np);
                if (ret) {
                        pr_err("failed to get resource of SMP control\n");
                        return ret;