Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1687987
| From | Julia Lawall <Julia.Lawall@lip6.fr> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH] cpufreq: s5pv210: add missing of_node_put |
| Date | 2017-07-15 22:10 +0200 |
| Message-ID | <u3By2-5SN-7@gated-at.bofh.it> (permalink) |
| Organization | linux.* mail to news gateway |
for_each_compatible_node performs an of_node_get on each iteration, so a
return from the loop requires an of_node_put.
The semantic patch that fixes this problem is as follows
(http://coccinelle.lip6.fr):
// <smpl>
@@
local idexpression n;
expression e,e1,e2;
statement S;
iterator i1;
iterator name for_each_compatible_node;
@@
for_each_compatible_node(n,e1,e2) {
...
(
of_node_put(n);
|
e = n
|
return n;
|
i1(...,n,...) S
|
+ of_node_put(n);
? return ...;
)
...
}
// </smpl>
Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
---
drivers/cpufreq/s5pv210-cpufreq.c | 2 ++
1 file changed, 2 insertions(+)
diff -u -p a/drivers/cpufreq/s5pv210-cpufreq.c b/drivers/cpufreq/s5pv210-cpufreq.c
--- a/drivers/cpufreq/s5pv210-cpufreq.c
+++ b/drivers/cpufreq/s5pv210-cpufreq.c
@@ -612,6 +612,7 @@ static int s5pv210_cpufreq_probe(struct
if (id < 0 || id >= ARRAY_SIZE(dmc_base)) {
pr_err("%s: failed to get alias of dmc node '%s'\n",
__func__, np->name);
+ of_node_put(np);
return id;
}
@@ -619,6 +620,7 @@ static int s5pv210_cpufreq_probe(struct
if (!dmc_base[id]) {
pr_err("%s: failed to map dmc%d registers\n",
__func__, id);
+ of_node_put(np);
return -EFAULT;
}
}
Back to linux.kernel | Previous | Next — Next in thread | Find similar | Unroll thread
[PATCH] cpufreq: s5pv210: add missing of_node_put Julia Lawall <Julia.Lawall@lip6.fr> - 2017-07-15 22:10 +0200 Re: [PATCH] cpufreq: s5pv210: add missing of_node_put Viresh Kumar <viresh.kumar@linaro.org> - 2017-07-17 10:50 +0200
csiph-web