aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/cpufreq/arm_big_little_dt.c
diff options
context:
space:
mode:
authorViresh Kumar <viresh.kumar@linaro.org>2013-04-15 03:05:24 -0400
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2013-04-21 18:53:40 -0400
commit763f8c3fe493693d8c651bd6352a67acc798e361 (patch)
tree8dd9b03592723c8ec06472e72ffa0daa34066d3a /drivers/cpufreq/arm_big_little_dt.c
parent820c6ca293e99ae225dc9dd7e0e689c444b08f92 (diff)
cpufreq: ARM big LITTLE: put DT nodes after using them
DT nodes should be put using of_node_put() to balance their usage counts. This is not done properly in ARM's big LITTLE driver. Fix it. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/cpufreq/arm_big_little_dt.c')
-rw-r--r--drivers/cpufreq/arm_big_little_dt.c43
1 files changed, 29 insertions, 14 deletions
diff --git a/drivers/cpufreq/arm_big_little_dt.c b/drivers/cpufreq/arm_big_little_dt.c
index 452ff46f20b7..44be3115375c 100644
--- a/drivers/cpufreq/arm_big_little_dt.c
+++ b/drivers/cpufreq/arm_big_little_dt.c
@@ -31,22 +31,28 @@
31 31
32static int dt_init_opp_table(struct device *cpu_dev) 32static int dt_init_opp_table(struct device *cpu_dev)
33{ 33{
34 struct device_node *np = NULL; 34 struct device_node *np, *parent;
35 int count = 0, ret; 35 int count = 0, ret;
36 36
37 for_each_child_of_node(of_find_node_by_path("/cpus"), np) { 37 parent = of_find_node_by_path("/cpus");
38 if (!parent) {
39 pr_err("failed to find OF /cpus\n");
40 return -ENOENT;
41 }
42
43 for_each_child_of_node(parent, np) {
38 if (count++ != cpu_dev->id) 44 if (count++ != cpu_dev->id)
39 continue; 45 continue;
40 if (!of_get_property(np, "operating-points", NULL)) 46 if (!of_get_property(np, "operating-points", NULL)) {
41 return -ENODATA; 47 ret = -ENODATA;
42 48 } else {
43 cpu_dev->of_node = np; 49 cpu_dev->of_node = np;
44 50 ret = of_init_opp_table(cpu_dev);
45 ret = of_init_opp_table(cpu_dev); 51 }
46 if (ret) 52 of_node_put(np);
47 return ret; 53 of_node_put(parent);
48 54
49 return 0; 55 return ret;
50 } 56 }
51 57
52 return -ENODEV; 58 return -ENODEV;
@@ -54,15 +60,24 @@ static int dt_init_opp_table(struct device *cpu_dev)
54 60
55static int dt_get_transition_latency(struct device *cpu_dev) 61static int dt_get_transition_latency(struct device *cpu_dev)
56{ 62{
57 struct device_node *np = NULL; 63 struct device_node *np, *parent;
58 u32 transition_latency = CPUFREQ_ETERNAL; 64 u32 transition_latency = CPUFREQ_ETERNAL;
59 int count = 0; 65 int count = 0;
60 66
61 for_each_child_of_node(of_find_node_by_path("/cpus"), np) { 67 parent = of_find_node_by_path("/cpus");
68 if (!parent) {
69 pr_err("failed to find OF /cpus\n");
70 return -ENOENT;
71 }
72
73 for_each_child_of_node(parent, np) {
62 if (count++ != cpu_dev->id) 74 if (count++ != cpu_dev->id)
63 continue; 75 continue;
64 76
65 of_property_read_u32(np, "clock-latency", &transition_latency); 77 of_property_read_u32(np, "clock-latency", &transition_latency);
78 of_node_put(np);
79 of_node_put(parent);
80
66 return 0; 81 return 0;
67 } 82 }
68 83