csky: Don't leak device tree node reference
authorYangtao Li <tiny.windzz@gmail.com>
Thu, 27 Dec 2018 17:45:51 +0000 (12:45 -0500)
committerGuo Ren <ren_guo@c-sky.com>
Sun, 30 Dec 2018 12:25:39 +0000 (20:25 +0800)
of_find_node_by_type() acquires a reference to the node returned by it
and that reference needs to be dropped by its caller. setup_smp()
doesn't do that, so fix it by converting to for_each_of_cpu_node().

Signed-off-by: Yangtao Li <tiny.windzz@gmail.com>
Signed-off-by: Guo Ren <guoren@kernel.org>
arch/csky/kernel/smp.c

index 36ebaf9..74d6273 100644 (file)
@@ -138,7 +138,7 @@ void __init setup_smp(void)
        struct device_node *node = NULL;
        int cpu;
 
-       while ((node = of_find_node_by_type(node, "cpu"))) {
+       for_each_of_cpu_node(node) {
                if (!of_device_is_available(node))
                        continue;