Skip to content

Commit 3be466d

Browse files
TinyWindzzrafaeljw
authored andcommitted
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: 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>
1 parent 60935c1 commit 3be466d

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

drivers/cpufreq/powernv-cpufreq.c

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -253,18 +253,18 @@ static int init_powernv_pstates(void)
253253

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

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

264264
if (of_property_read_u32(power_mgt, "ibm,pstate-nominal",
265265
&pstate_nominal)) {
266266
pr_warn("ibm,pstate-nominal not found\n");
267-
return -ENODEV;
267+
goto out;
268268
}
269269

270270
if (of_property_read_u32(power_mgt, "ibm,pstate-ultra-turbo",
@@ -293,14 +293,14 @@ static int init_powernv_pstates(void)
293293
pstate_ids = of_get_property(power_mgt, "ibm,pstate-ids", &len_ids);
294294
if (!pstate_ids) {
295295
pr_warn("ibm,pstate-ids not found\n");
296-
return -ENODEV;
296+
goto out;
297297
}
298298

299299
pstate_freqs = of_get_property(power_mgt, "ibm,pstate-frequencies-mhz",
300300
&len_freqs);
301301
if (!pstate_freqs) {
302302
pr_warn("ibm,pstate-frequencies-mhz not found\n");
303-
return -ENODEV;
303+
goto out;
304304
}
305305

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

317317
powernv_pstate_info.nr_pstates = nr_pstates;
@@ -352,7 +352,12 @@ static int init_powernv_pstates(void)
352352

353353
/* End of list marker entry */
354354
powernv_freqs[i].frequency = CPUFREQ_TABLE_END;
355+
356+
of_node_put(power_mgt);
355357
return 0;
358+
out:
359+
of_node_put(power_mgt);
360+
return -ENODEV;
356361
}
357362

358363
/* Returns the CPU frequency corresponding to the pstate_id. */

0 commit comments

Comments
 (0)