]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
ARM: hisi: Add missing of_node_put after of_find_compatible_node
authorPeng Wu <wupeng58@huawei.com>
Thu, 28 Apr 2022 10:43:06 +0000 (10:43 +0000)
committerStefan Bader <stefan.bader@canonical.com>
Wed, 10 Aug 2022 07:23:57 +0000 (09:23 +0200)
BugLink: https://bugs.launchpad.net/bugs/1981864
[ Upstream commit 9bc72e47d4630d58a840a66a869c56b29554cfe4 ]

of_find_compatible_node  will increment the refcount of the returned
device_node. Calling of_node_put() to avoid the refcount leak

Signed-off-by: Peng Wu <wupeng58@huawei.com>
Signed-off-by: Wei Xu <xuwei5@hisilicon.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
arch/arm/mach-hisi/platsmp.c

index a56cc64deeb8ff8a8bd5267f5d6fbc74c58f2b1e..9ce93e0b6cdc355618d488f15848e8841bf442af 100644 (file)
@@ -67,14 +67,17 @@ static void __init hi3xxx_smp_prepare_cpus(unsigned int max_cpus)
                }
                ctrl_base = of_iomap(np, 0);
                if (!ctrl_base) {
+                       of_node_put(np);
                        pr_err("failed to map address\n");
                        return;
                }
                if (of_property_read_u32(np, "smp-offset", &offset) < 0) {
+                       of_node_put(np);
                        pr_err("failed to find smp-offset property\n");
                        return;
                }
                ctrl_base += offset;
+               of_node_put(np);
        }
 }
 
@@ -160,6 +163,7 @@ static int hip01_boot_secondary(unsigned int cpu, struct task_struct *idle)
        if (WARN_ON(!node))
                return -1;
        ctrl_base = of_iomap(node, 0);
+       of_node_put(node);
 
        /* set the secondary core boot from DDR */
        remap_reg_value = readl_relaxed(ctrl_base + REG_SC_CTRL);