Skip to content

Commit b96f038

Browse files
Wang ShaoBorafaeljw
authored andcommitted
cpufreq: Fix cpufreq_online() return value on errors
Make cpufreq_online() return negative error codes on all errors that cause the policy to be destroyed, as appropriate. Signed-off-by: Wang ShaoBo <bobo.shaobowang@huawei.com> [ rjw: Subject and changelog edits ] Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
1 parent ec06e58 commit b96f038

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

drivers/cpufreq/cpufreq.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1393,8 +1393,10 @@ static int cpufreq_online(unsigned int cpu)
13931393

13941394
policy->min_freq_req = kzalloc(2 * sizeof(*policy->min_freq_req),
13951395
GFP_KERNEL);
1396-
if (!policy->min_freq_req)
1396+
if (!policy->min_freq_req) {
1397+
ret = -ENOMEM;
13971398
goto out_destroy_policy;
1399+
}
13981400

13991401
ret = freq_qos_add_request(&policy->constraints,
14001402
policy->min_freq_req, FREQ_QOS_MIN,
@@ -1431,6 +1433,7 @@ static int cpufreq_online(unsigned int cpu)
14311433
if (cpufreq_driver->get && has_target()) {
14321434
policy->cur = cpufreq_driver->get(policy->cpu);
14331435
if (!policy->cur) {
1436+
ret = -EIO;
14341437
pr_err("%s: ->get() failed\n", __func__);
14351438
goto out_destroy_policy;
14361439
}

0 commit comments

Comments
 (0)