Skip to content

Commit d3c1e33

Browse files
JuliaLawallvireshk
authored andcommitted
cpufreq: ap806: add missing of_node_put after of_device_is_available
Add an of_node_put when a tested device node is not available. The semantic patch that fixes this problem is as follows (http://coccinelle.lip6.fr): // <smpl> @@ identifier f; local idexpression e; expression x; @@ e = f(...); ... when != of_node_put(e) when != x = e when != e = x when any if (<+...of_device_is_available(e)...+>) { ... when != of_node_put(e) ( return e; | + of_node_put(e); return ...; ) } // </smpl> Fixes: f525a67 ("cpufreq: ap806: add cpufreq driver for Armada 8K") Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
1 parent f525a67 commit d3c1e33

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

drivers/cpufreq/armada-8k-cpufreq.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,10 @@ static int __init armada_8k_cpufreq_init(void)
128128
struct cpumask cpus;
129129

130130
node = of_find_compatible_node(NULL, NULL, "marvell,ap806-cpu-clock");
131-
if (!node || !of_device_is_available(node))
131+
if (!node || !of_device_is_available(node)) {
132+
of_node_put(node);
132133
return -ENODEV;
134+
}
133135

134136
nb_cpus = num_possible_cpus();
135137
freq_tables = kcalloc(nb_cpus, sizeof(*freq_tables), GFP_KERNEL);

0 commit comments

Comments
 (0)