Skip to content

Commit

Permalink
cpufreq: powernv: add of_node_put()
Browse files Browse the repository at this point in the history
The of_find_node_by_path() returns a node pointer with refcount
incremented,but there is the lack of use of the of_node_put() when
done.Add the missing of_node_put() to release the refcount.

Signed-off-by: Yangtao Li <tiny.windzz@gmail.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
  • Loading branch information
Yangtao Li authored and Rafael J. Wysocki committed Nov 29, 2018
1 parent 60935c1 commit 3be466d
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions drivers/cpufreq/powernv-cpufreq.c
Original file line number Diff line number Diff line change
Expand Up @@ -253,18 +253,18 @@ static int init_powernv_pstates(void)

if (of_property_read_u32(power_mgt, "ibm,pstate-min", &pstate_min)) {
pr_warn("ibm,pstate-min node not found\n");
return -ENODEV;
goto out;
}

if (of_property_read_u32(power_mgt, "ibm,pstate-max", &pstate_max)) {
pr_warn("ibm,pstate-max node not found\n");
return -ENODEV;
goto out;
}

if (of_property_read_u32(power_mgt, "ibm,pstate-nominal",
&pstate_nominal)) {
pr_warn("ibm,pstate-nominal not found\n");
return -ENODEV;
goto out;
}

if (of_property_read_u32(power_mgt, "ibm,pstate-ultra-turbo",
Expand Down Expand Up @@ -293,14 +293,14 @@ static int init_powernv_pstates(void)
pstate_ids = of_get_property(power_mgt, "ibm,pstate-ids", &len_ids);
if (!pstate_ids) {
pr_warn("ibm,pstate-ids not found\n");
return -ENODEV;
goto out;
}

pstate_freqs = of_get_property(power_mgt, "ibm,pstate-frequencies-mhz",
&len_freqs);
if (!pstate_freqs) {
pr_warn("ibm,pstate-frequencies-mhz not found\n");
return -ENODEV;
goto out;
}

if (len_ids != len_freqs) {
Expand All @@ -311,7 +311,7 @@ static int init_powernv_pstates(void)
nr_pstates = min(len_ids, len_freqs) / sizeof(u32);
if (!nr_pstates) {
pr_warn("No PStates found\n");
return -ENODEV;
goto out;
}

powernv_pstate_info.nr_pstates = nr_pstates;
Expand Down Expand Up @@ -352,7 +352,12 @@ static int init_powernv_pstates(void)

/* End of list marker entry */
powernv_freqs[i].frequency = CPUFREQ_TABLE_END;

of_node_put(power_mgt);
return 0;
out:
of_node_put(power_mgt);
return -ENODEV;
}

/* Returns the CPU frequency corresponding to the pstate_id. */
Expand Down

0 comments on commit 3be466d

Please sign in to comment.