Commit 3be466d6 authored by Yangtao Li's avatar Yangtao Li Committed by Rafael J. Wysocki

cpufreq: powernv: add of_node_put()

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: default avatarYangtao Li <tiny.windzz@gmail.com>
Acked-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
parent 60935c17
...@@ -253,18 +253,18 @@ static int init_powernv_pstates(void) ...@@ -253,18 +253,18 @@ static int init_powernv_pstates(void)
if (of_property_read_u32(power_mgt, "ibm,pstate-min", &pstate_min)) { if (of_property_read_u32(power_mgt, "ibm,pstate-min", &pstate_min)) {
pr_warn("ibm,pstate-min node not found\n"); 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)) { if (of_property_read_u32(power_mgt, "ibm,pstate-max", &pstate_max)) {
pr_warn("ibm,pstate-max node not found\n"); pr_warn("ibm,pstate-max node not found\n");
return -ENODEV; goto out;
} }
if (of_property_read_u32(power_mgt, "ibm,pstate-nominal", if (of_property_read_u32(power_mgt, "ibm,pstate-nominal",
&pstate_nominal)) { &pstate_nominal)) {
pr_warn("ibm,pstate-nominal not found\n"); pr_warn("ibm,pstate-nominal not found\n");
return -ENODEV; goto out;
} }
if (of_property_read_u32(power_mgt, "ibm,pstate-ultra-turbo", if (of_property_read_u32(power_mgt, "ibm,pstate-ultra-turbo",
...@@ -293,14 +293,14 @@ static int init_powernv_pstates(void) ...@@ -293,14 +293,14 @@ static int init_powernv_pstates(void)
pstate_ids = of_get_property(power_mgt, "ibm,pstate-ids", &len_ids); pstate_ids = of_get_property(power_mgt, "ibm,pstate-ids", &len_ids);
if (!pstate_ids) { if (!pstate_ids) {
pr_warn("ibm,pstate-ids not found\n"); pr_warn("ibm,pstate-ids not found\n");
return -ENODEV; goto out;
} }
pstate_freqs = of_get_property(power_mgt, "ibm,pstate-frequencies-mhz", pstate_freqs = of_get_property(power_mgt, "ibm,pstate-frequencies-mhz",
&len_freqs); &len_freqs);
if (!pstate_freqs) { if (!pstate_freqs) {
pr_warn("ibm,pstate-frequencies-mhz not found\n"); pr_warn("ibm,pstate-frequencies-mhz not found\n");
return -ENODEV; goto out;
} }
if (len_ids != len_freqs) { if (len_ids != len_freqs) {
...@@ -311,7 +311,7 @@ static int init_powernv_pstates(void) ...@@ -311,7 +311,7 @@ static int init_powernv_pstates(void)
nr_pstates = min(len_ids, len_freqs) / sizeof(u32); nr_pstates = min(len_ids, len_freqs) / sizeof(u32);
if (!nr_pstates) { if (!nr_pstates) {
pr_warn("No PStates found\n"); pr_warn("No PStates found\n");
return -ENODEV; goto out;
} }
powernv_pstate_info.nr_pstates = nr_pstates; powernv_pstate_info.nr_pstates = nr_pstates;
...@@ -352,7 +352,12 @@ static int init_powernv_pstates(void) ...@@ -352,7 +352,12 @@ static int init_powernv_pstates(void)
/* End of list marker entry */ /* End of list marker entry */
powernv_freqs[i].frequency = CPUFREQ_TABLE_END; powernv_freqs[i].frequency = CPUFREQ_TABLE_END;
of_node_put(power_mgt);
return 0; return 0;
out:
of_node_put(power_mgt);
return -ENODEV;
} }
/* Returns the CPU frequency corresponding to the pstate_id. */ /* Returns the CPU frequency corresponding to the pstate_id. */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment