LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] cpufreq: arm_scmi: Fix error path when allocation failed
@ 2021-08-02 20:45 Lukasz Luba
2021-08-03 4:34 ` Viresh Kumar
0 siblings, 1 reply; 3+ messages in thread
From: Lukasz Luba @ 2021-08-02 20:45 UTC (permalink / raw)
To: linux-kernel
Cc: sudeep.holla, cristian.marussi, rjw, viresh.kumar,
nicola.mazzucato, lukasz.luba, linux-arm-kernel, linux-pm
Print warning and return an error which would stop the initialization
when cpumask allocation failed.
Fixes: 80a064dbd556 ("scmi-cpufreq: Get opp_shared_cpus from opp-v2 for EM")
Signed-off-by: Lukasz Luba <lukasz.luba@arm.com>
---
drivers/cpufreq/scmi-cpufreq.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/cpufreq/scmi-cpufreq.c b/drivers/cpufreq/scmi-cpufreq.c
index ec9a87ca2dbb..b159123e68fd 100644
--- a/drivers/cpufreq/scmi-cpufreq.c
+++ b/drivers/cpufreq/scmi-cpufreq.c
@@ -133,8 +133,10 @@ static int scmi_cpufreq_init(struct cpufreq_policy *policy)
return -ENODEV;
}
- if (!zalloc_cpumask_var(&opp_shared_cpus, GFP_KERNEL))
- ret = -ENOMEM;
+ if (!zalloc_cpumask_var(&opp_shared_cpus, GFP_KERNEL)) {
+ dev_warn(cpu_dev, "failed to allocate cpumask\n");
+ return -ENOMEM;
+ }
/* Obtain CPUs that share SCMI performance controls */
ret = scmi_get_sharing_cpus(cpu_dev, policy->cpus);
--
2.17.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] cpufreq: arm_scmi: Fix error path when allocation failed
2021-08-02 20:45 [PATCH] cpufreq: arm_scmi: Fix error path when allocation failed Lukasz Luba
@ 2021-08-03 4:34 ` Viresh Kumar
2021-08-03 8:49 ` Lukasz Luba
0 siblings, 1 reply; 3+ messages in thread
From: Viresh Kumar @ 2021-08-03 4:34 UTC (permalink / raw)
To: Lukasz Luba
Cc: linux-kernel, sudeep.holla, cristian.marussi, rjw,
nicola.mazzucato, linux-arm-kernel, linux-pm
On 02-08-21, 21:45, Lukasz Luba wrote:
> Print warning and return an error which would stop the initialization
> when cpumask allocation failed.
>
> Fixes: 80a064dbd556 ("scmi-cpufreq: Get opp_shared_cpus from opp-v2 for EM")
> Signed-off-by: Lukasz Luba <lukasz.luba@arm.com>
> ---
> drivers/cpufreq/scmi-cpufreq.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/cpufreq/scmi-cpufreq.c b/drivers/cpufreq/scmi-cpufreq.c
> index ec9a87ca2dbb..b159123e68fd 100644
> --- a/drivers/cpufreq/scmi-cpufreq.c
> +++ b/drivers/cpufreq/scmi-cpufreq.c
> @@ -133,8 +133,10 @@ static int scmi_cpufreq_init(struct cpufreq_policy *policy)
> return -ENODEV;
> }
>
> - if (!zalloc_cpumask_var(&opp_shared_cpus, GFP_KERNEL))
> - ret = -ENOMEM;
> + if (!zalloc_cpumask_var(&opp_shared_cpus, GFP_KERNEL)) {
> + dev_warn(cpu_dev, "failed to allocate cpumask\n");
We shouldn't be printing here anything I believe as the allocation
core does it for us. That's why you won't see a print message anywhere
for failed allocations.
> + return -ENOMEM;
> + }
>
> /* Obtain CPUs that share SCMI performance controls */
> ret = scmi_get_sharing_cpus(cpu_dev, policy->cpus);
> --
> 2.17.1
>
--
viresh
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] cpufreq: arm_scmi: Fix error path when allocation failed
2021-08-03 4:34 ` Viresh Kumar
@ 2021-08-03 8:49 ` Lukasz Luba
0 siblings, 0 replies; 3+ messages in thread
From: Lukasz Luba @ 2021-08-03 8:49 UTC (permalink / raw)
To: Viresh Kumar
Cc: linux-kernel, sudeep.holla, cristian.marussi, rjw,
nicola.mazzucato, linux-arm-kernel, linux-pm
Hi Viresh,
On 8/3/21 5:34 AM, Viresh Kumar wrote:
> On 02-08-21, 21:45, Lukasz Luba wrote:
>> Print warning and return an error which would stop the initialization
>> when cpumask allocation failed.
>>
>> Fixes: 80a064dbd556 ("scmi-cpufreq: Get opp_shared_cpus from opp-v2 for EM")
>> Signed-off-by: Lukasz Luba <lukasz.luba@arm.com>
>> ---
>> drivers/cpufreq/scmi-cpufreq.c | 6 ++++--
>> 1 file changed, 4 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/cpufreq/scmi-cpufreq.c b/drivers/cpufreq/scmi-cpufreq.c
>> index ec9a87ca2dbb..b159123e68fd 100644
>> --- a/drivers/cpufreq/scmi-cpufreq.c
>> +++ b/drivers/cpufreq/scmi-cpufreq.c
>> @@ -133,8 +133,10 @@ static int scmi_cpufreq_init(struct cpufreq_policy *policy)
>> return -ENODEV;
>> }
>>
>> - if (!zalloc_cpumask_var(&opp_shared_cpus, GFP_KERNEL))
>> - ret = -ENOMEM;
>> + if (!zalloc_cpumask_var(&opp_shared_cpus, GFP_KERNEL)) {
>> + dev_warn(cpu_dev, "failed to allocate cpumask\n");
>
> We shouldn't be printing here anything I believe as the allocation
> core does it for us. That's why you won't see a print message anywhere
> for failed allocations.
Thanks for the comment. Let me send the v2.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-08-03 8:49 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-02 20:45 [PATCH] cpufreq: arm_scmi: Fix error path when allocation failed Lukasz Luba
2021-08-03 4:34 ` Viresh Kumar
2021-08-03 8:49 ` Lukasz Luba
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).