From: Wang ShaoBo <bobo.shaobowang@huawei.com>
To: <rjw@rjwysocki.net>
Cc: <viresh.kumar@linaro.org>, <linux-pm@vger.kernel.org>,
<linux-kernel@vger.kernel.org>, <huawei.libin@huawei.com>,
<cj.chengjian@huawei.com>, <bobo.shaobowang@huawei.com>
Subject: [PATCH v2] cpufreq: Fix error return code in cpufreq_online()
Date: Thu, 26 Nov 2020 09:12:39 +0800 [thread overview]
Message-ID: <20201126011239.42294-1-bobo.shaobowang@huawei.com> (raw)
Fix to return proper error code instead of 0 in cpufreq_online(), as done
elsewhere in this function.
Signed-off-by: Wang ShaoBo <bobo.shaobowang@huawei.com>
---
drivers/cpufreq/cpufreq.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index 1e7e3f2ff09f..d3a28de35593 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -1391,8 +1391,10 @@ static int cpufreq_online(unsigned int cpu)
policy->min_freq_req = kzalloc(2 * sizeof(*policy->min_freq_req),
GFP_KERNEL);
- if (!policy->min_freq_req)
+ if (!policy->min_freq_req) {
+ ret = -ENOMEM;
goto out_destroy_policy;
+ }
ret = freq_qos_add_request(&policy->constraints,
policy->min_freq_req, FREQ_QOS_MIN,
@@ -1429,6 +1431,7 @@ static int cpufreq_online(unsigned int cpu)
if (cpufreq_driver->get && has_target()) {
policy->cur = cpufreq_driver->get(policy->cpu);
if (!policy->cur) {
+ ret = -EIO;
pr_err("%s: ->get() failed\n", __func__);
goto out_destroy_policy;
}
--
2.17.1
next reply other threads:[~2020-11-26 1:13 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-26 1:12 Wang ShaoBo [this message]
2020-11-26 17:09 ` [PATCH v2] cpufreq: Fix error return code in cpufreq_online() Rafael J. Wysocki
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201126011239.42294-1-bobo.shaobowang@huawei.com \
--to=bobo.shaobowang@huawei.com \
--cc=cj.chengjian@huawei.com \
--cc=huawei.libin@huawei.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=rjw@rjwysocki.net \
--cc=viresh.kumar@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).