Skip to content

Commit

Permalink
cpufreq: ARM big LITTLE: put DT nodes after using them
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Viresh Kumar authored and Rafael J. Wysocki committed Apr 21, 2013
1 parent 820c6ca commit 763f8c3
Showing 1 changed file with 29 additions and 14 deletions.
43 changes: 29 additions & 14 deletions drivers/cpufreq/arm_big_little_dt.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,38 +31,53 @@

static int dt_init_opp_table(struct device *cpu_dev)
{
struct device_node *np = NULL;
struct device_node *np, *parent;
int count = 0, ret;

for_each_child_of_node(of_find_node_by_path("/cpus"), np) {
parent = of_find_node_by_path("/cpus");
if (!parent) {
pr_err("failed to find OF /cpus\n");
return -ENOENT;
}

for_each_child_of_node(parent, np) {
if (count++ != cpu_dev->id)
continue;
if (!of_get_property(np, "operating-points", NULL))
return -ENODATA;

cpu_dev->of_node = np;

ret = of_init_opp_table(cpu_dev);
if (ret)
return ret;

return 0;
if (!of_get_property(np, "operating-points", NULL)) {
ret = -ENODATA;
} else {
cpu_dev->of_node = np;
ret = of_init_opp_table(cpu_dev);
}
of_node_put(np);
of_node_put(parent);

return ret;
}

return -ENODEV;
}

static int dt_get_transition_latency(struct device *cpu_dev)
{
struct device_node *np = NULL;
struct device_node *np, *parent;
u32 transition_latency = CPUFREQ_ETERNAL;
int count = 0;

for_each_child_of_node(of_find_node_by_path("/cpus"), np) {
parent = of_find_node_by_path("/cpus");
if (!parent) {
pr_err("failed to find OF /cpus\n");
return -ENOENT;
}

for_each_child_of_node(parent, np) {
if (count++ != cpu_dev->id)
continue;

of_property_read_u32(np, "clock-latency", &transition_latency);
of_node_put(np);
of_node_put(parent);

return 0;
}

Expand Down

0 comments on commit 763f8c3

Please sign in to comment.