Skip to content

Commit 9bc72e4

Browse files
Peng Wujoyxu
authored andcommitted
ARM: hisi: Add missing of_node_put after of_find_compatible_node
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>
1 parent 3123109 commit 9bc72e4

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

arch/arm/mach-hisi/platsmp.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,14 +67,17 @@ static void __init hi3xxx_smp_prepare_cpus(unsigned int max_cpus)
6767
}
6868
ctrl_base = of_iomap(np, 0);
6969
if (!ctrl_base) {
70+
of_node_put(np);
7071
pr_err("failed to map address\n");
7172
return;
7273
}
7374
if (of_property_read_u32(np, "smp-offset", &offset) < 0) {
75+
of_node_put(np);
7476
pr_err("failed to find smp-offset property\n");
7577
return;
7678
}
7779
ctrl_base += offset;
80+
of_node_put(np);
7881
}
7982
}
8083

@@ -160,6 +163,7 @@ static int hip01_boot_secondary(unsigned int cpu, struct task_struct *idle)
160163
if (WARN_ON(!node))
161164
return -1;
162165
ctrl_base = of_iomap(node, 0);
166+
of_node_put(node);
163167

164168
/* set the secondary core boot from DDR */
165169
remap_reg_value = readl_relaxed(ctrl_base + REG_SC_CTRL);

0 commit comments

Comments
 (0)