linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] cpufreq: Fix error return code in cpufreq_online()
@ 2020-11-26  1:12 Wang ShaoBo
  2020-11-26 17:09 ` Rafael J. Wysocki
  0 siblings, 1 reply; 2+ messages in thread
From: Wang ShaoBo @ 2020-11-26  1:12 UTC (permalink / raw)
  To: rjw
  Cc: viresh.kumar, linux-pm, linux-kernel, huawei.libin, cj.chengjian,
	bobo.shaobowang

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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v2] cpufreq: Fix error return code in cpufreq_online()
  2020-11-26  1:12 [PATCH v2] cpufreq: Fix error return code in cpufreq_online() Wang ShaoBo
@ 2020-11-26 17:09 ` Rafael J. Wysocki
  0 siblings, 0 replies; 2+ messages in thread
From: Rafael J. Wysocki @ 2020-11-26 17:09 UTC (permalink / raw)
  To: Wang ShaoBo
  Cc: Rafael J. Wysocki, Viresh Kumar, Linux PM,
	Linux Kernel Mailing List, huawei.libin, cj.chengjian

On Thu, Nov 26, 2020 at 2:12 AM Wang ShaoBo <bobo.shaobowang@huawei.com> wrote:
>
> 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;
>                 }
> --

Applied as 5.11 material with a modified subject and some changelog
edits, thanks!

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-11-26 17:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-26  1:12 [PATCH v2] cpufreq: Fix error return code in cpufreq_online() Wang ShaoBo
2020-11-26 17:09 ` Rafael J. Wysocki

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).