* [PATCH] arm: add missing of_node_put()
@ 2018-11-20 14:01 Yangtao Li
0 siblings, 0 replies; 4+ messages in thread
From: Yangtao Li @ 2018-11-20 14:01 UTC (permalink / raw)
To: linux, akpm, rppt, robh, mhocko
Cc: linux-arm-kernel, linux-kernel, Yangtao Li
use of_node_put() to release the refcount.
Signed-off-by: Yangtao Li <tiny.windzz@gmail.com>
---
arch/arm/kernel/devtree.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/arch/arm/kernel/devtree.c b/arch/arm/kernel/devtree.c
index e3057c1b55b9..9576adf0d15b 100644
--- a/arch/arm/kernel/devtree.c
+++ b/arch/arm/kernel/devtree.c
@@ -101,7 +101,7 @@ void __init arm_dt_init_cpu_maps(void)
if (!cell || prop_bytes < sizeof(*cell)) {
pr_debug(" * %pOF missing reg property\n", cpu);
of_node_put(cpu);
- return;
+ goto out;
}
/*
@@ -115,7 +115,7 @@ void __init arm_dt_init_cpu_maps(void)
if (prop_bytes || (hwid & ~MPIDR_HWID_BITMASK)) {
of_node_put(cpu);
- return;
+ goto out;
}
/*
@@ -129,7 +129,7 @@ void __init arm_dt_init_cpu_maps(void)
if (WARN(tmp_map[j] == hwid,
"Duplicate /cpu reg properties in the DT\n")) {
of_node_put(cpu);
- return;
+ goto out;
}
/*
@@ -171,7 +171,7 @@ void __init arm_dt_init_cpu_maps(void)
if (!bootcpu_valid) {
pr_warn("DT missing boot CPU MPIDR[23:0], fall back to default cpu_logical_map\n");
- return;
+ goto out;
}
/*
@@ -184,6 +184,8 @@ void __init arm_dt_init_cpu_maps(void)
cpu_logical_map(i) = tmp_map[i];
pr_debug("cpu logical map 0x%x\n", cpu_logical_map(i));
}
+out:
+ of_node_put(cpus);
}
bool arch_match_cpu_phys_id(int cpu, u64 phys_id)
--
2.17.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH] ARM: add missing of_node_put()
2019-04-13 7:14 [PATCH 0/4] ARM: imx legacy: cleanups Nicholas Mc Guire
@ 2019-04-13 7:14 ` Nicholas Mc Guire
0 siblings, 0 replies; 4+ messages in thread
From: Nicholas Mc Guire @ 2019-04-13 7:14 UTC (permalink / raw)
To: Russell King
Cc: Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
NXP Linux Team, Mark Brown, Linus Walleij, Tony Lindgren,
Mike Rapoport, Janusz Krzysztofik, linux-arm-kernel,
linux-kernel, Nicholas Mc Guire
The call to of_find_compatible_node() returns a node pointer with refcount
incremented thus it must be explicitly decremented here after the last
usage. (see drivers/of/base.c:of_find_compatible_node())
Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
---
Problem located with an experimental coccinelle script
Patch was compile tested with: axm55xx_defconfig
(with some sparse warnings - not related to the proposed change though)
Patch is against 4.17.0 (localversion-next is next-20180614)
arch/arm/mach-axxia/platsmp.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/arm/mach-axxia/platsmp.c b/arch/arm/mach-axxia/platsmp.c
index 502e3df..c706a11 100644
--- a/arch/arm/mach-axxia/platsmp.c
+++ b/arch/arm/mach-axxia/platsmp.c
@@ -40,10 +40,11 @@ static int axxia_boot_secondary(unsigned int cpu, struct task_struct *idle)
syscon_np = of_find_compatible_node(NULL, NULL, "lsi,axxia-syscon");
if (!syscon_np)
return -ENOENT;
syscon = of_iomap(syscon_np, 0);
+ of_node_put(syscon_np);
if (!syscon)
return -ENOMEM;
tmp = readl(syscon + SC_RST_CPU_HOLD);
writel(0xab, syscon + SC_CRIT_WRITE_KEY);
--
2.1.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH] arm: add missing of_node_put()
@ 2018-11-20 13:56 Yangtao Li
0 siblings, 0 replies; 4+ messages in thread
From: Yangtao Li @ 2018-11-20 13:56 UTC (permalink / raw)
To: linux, akpm, mhocko, rppt, robh
Cc: linux-arm-kernel, linux-kernel, Yangtao Li
use of_node_put() to release the refcount.
Signed-off-by: Yangtao Li <tiny.windzz@gmail.com>
---
arch/arm/kernel/devtree.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/arch/arm/kernel/devtree.c b/arch/arm/kernel/devtree.c
index e3057c1b55b9..9576adf0d15b 100644
--- a/arch/arm/kernel/devtree.c
+++ b/arch/arm/kernel/devtree.c
@@ -101,7 +101,7 @@ void __init arm_dt_init_cpu_maps(void)
if (!cell || prop_bytes < sizeof(*cell)) {
pr_debug(" * %pOF missing reg property\n", cpu);
of_node_put(cpu);
- return;
+ goto out;
}
/*
@@ -115,7 +115,7 @@ void __init arm_dt_init_cpu_maps(void)
if (prop_bytes || (hwid & ~MPIDR_HWID_BITMASK)) {
of_node_put(cpu);
- return;
+ goto out;
}
/*
@@ -129,7 +129,7 @@ void __init arm_dt_init_cpu_maps(void)
if (WARN(tmp_map[j] == hwid,
"Duplicate /cpu reg properties in the DT\n")) {
of_node_put(cpu);
- return;
+ goto out;
}
/*
@@ -171,7 +171,7 @@ void __init arm_dt_init_cpu_maps(void)
if (!bootcpu_valid) {
pr_warn("DT missing boot CPU MPIDR[23:0], fall back to default cpu_logical_map\n");
- return;
+ goto out;
}
/*
@@ -184,6 +184,8 @@ void __init arm_dt_init_cpu_maps(void)
cpu_logical_map(i) = tmp_map[i];
pr_debug("cpu logical map 0x%x\n", cpu_logical_map(i));
}
+out:
+ of_node_put(cpus);
}
bool arch_match_cpu_phys_id(int cpu, u64 phys_id)
--
2.17.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH] ARM: add missing of_node_put()
@ 2018-06-15 12:28 Nicholas Mc Guire
0 siblings, 0 replies; 4+ messages in thread
From: Nicholas Mc Guire @ 2018-06-15 12:28 UTC (permalink / raw)
To: Anders Berg
Cc: Russell King, linux-arm-kernel, linux-kernel, Nicholas Mc Guire
The call to of_find_compatible_node() returns a node pointer with refcount
incremented thus it must be explicitly decremented here after the last
usage. (see drivers/of/base.c:of_find_compatible_node())
Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
---
Problem located with an experimental coccinelle script
Patch was compile tested with: axm55xx_defconfig
(with some sparse warnings - not related to the proposed change though)
Patch is against 4.17.0 (localversion-next is next-20180614)
arch/arm/mach-axxia/platsmp.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/arm/mach-axxia/platsmp.c b/arch/arm/mach-axxia/platsmp.c
index 502e3df..c706a11 100644
--- a/arch/arm/mach-axxia/platsmp.c
+++ b/arch/arm/mach-axxia/platsmp.c
@@ -40,10 +40,11 @@ static int axxia_boot_secondary(unsigned int cpu, struct task_struct *idle)
syscon_np = of_find_compatible_node(NULL, NULL, "lsi,axxia-syscon");
if (!syscon_np)
return -ENOENT;
syscon = of_iomap(syscon_np, 0);
+ of_node_put(syscon_np);
if (!syscon)
return -ENOMEM;
tmp = readl(syscon + SC_RST_CPU_HOLD);
writel(0xab, syscon + SC_CRIT_WRITE_KEY);
--
2.1.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-04-13 7:20 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-20 14:01 [PATCH] arm: add missing of_node_put() Yangtao Li
-- strict thread matches above, loose matches on Subject: below --
2019-04-13 7:14 [PATCH 0/4] ARM: imx legacy: cleanups Nicholas Mc Guire
2019-04-13 7:14 ` [PATCH] ARM: add missing of_node_put() Nicholas Mc Guire
2018-11-20 13:56 [PATCH] arm: " Yangtao Li
2018-06-15 12:28 [PATCH] ARM: " Nicholas Mc Guire
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).