diff mbox series

[v2] cpufreq: arm_scmi: Fix error path when allocation failed

Message ID 20210803090744.12143-1-lukasz.luba@arm.com
State Accepted
Commit f7d635883fb73414c7c4e2648b42adc296c5d40d
Headers show
Series [v2] cpufreq: arm_scmi: Fix error path when allocation failed | expand

Commit Message

Lukasz Luba Aug. 3, 2021, 9:07 a.m. UTC
Stop the initialization when cpumask allocation failed and return an
error.

Fixes: 80a064dbd556 ("scmi-cpufreq: Get opp_shared_cpus from opp-v2 for EM")
Signed-off-by: Lukasz Luba <lukasz.luba@arm.com>
---
changes:
v2:
- removed dev_warn() since it's not needed in this case
- adjusted the patch description

 drivers/cpufreq/scmi-cpufreq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Sudeep Holla Aug. 3, 2021, 10:41 p.m. UTC | #1
On Tue, Aug 03, 2021 at 10:07:44AM +0100, Lukasz Luba wrote:
> Stop the initialization when cpumask allocation failed and return an
> error.
>

Good catch!

Reviewed-by: Sudeep Holla <sudeep.holla@arm.com>
Viresh Kumar Aug. 4, 2021, 4:02 a.m. UTC | #2
On 03-08-21, 10:07, Lukasz Luba wrote:
> Stop the initialization when cpumask allocation failed and return an

> error.

> 

> Fixes: 80a064dbd556 ("scmi-cpufreq: Get opp_shared_cpus from opp-v2 for EM")

> Signed-off-by: Lukasz Luba <lukasz.luba@arm.com>

> ---

> changes:

> v2:

> - removed dev_warn() since it's not needed in this case

> - adjusted the patch description

> 

>  drivers/cpufreq/scmi-cpufreq.c | 2 +-

>  1 file changed, 1 insertion(+), 1 deletion(-)

> 

> diff --git a/drivers/cpufreq/scmi-cpufreq.c b/drivers/cpufreq/scmi-cpufreq.c

> index ec9a87ca2dbb..75f818d04b48 100644

> --- a/drivers/cpufreq/scmi-cpufreq.c

> +++ b/drivers/cpufreq/scmi-cpufreq.c

> @@ -134,7 +134,7 @@ static int scmi_cpufreq_init(struct cpufreq_policy *policy)

>  	}

>  

>  	if (!zalloc_cpumask_var(&opp_shared_cpus, GFP_KERNEL))

> -		ret = -ENOMEM;

> +		return -ENOMEM;

>  

>  	/* Obtain CPUs that share SCMI performance controls */

>  	ret = scmi_get_sharing_cpus(cpu_dev, policy->cpus);


Applied. Thanks.

-- 
viresh
Lukasz Luba Aug. 4, 2021, 10:51 a.m. UTC | #3
On 8/3/21 11:41 PM, Sudeep Holla wrote:
> On Tue, Aug 03, 2021 at 10:07:44AM +0100, Lukasz Luba wrote:

>> Stop the initialization when cpumask allocation failed and return an

>> error.

>>

> 

> Good catch!

> 

> Reviewed-by: Sudeep Holla <sudeep.holla@arm.com>

> 


Thank you for the review!
Lukasz Luba Aug. 4, 2021, 10:51 a.m. UTC | #4
On 8/4/21 5:02 AM, Viresh Kumar wrote:
> On 03-08-21, 10:07, Lukasz Luba wrote:

>> Stop the initialization when cpumask allocation failed and return an

>> error.

>>

>> Fixes: 80a064dbd556 ("scmi-cpufreq: Get opp_shared_cpus from opp-v2 for EM")

>> Signed-off-by: Lukasz Luba <lukasz.luba@arm.com>

>> ---

>> changes:

>> v2:

>> - removed dev_warn() since it's not needed in this case

>> - adjusted the patch description

>>

>>   drivers/cpufreq/scmi-cpufreq.c | 2 +-

>>   1 file changed, 1 insertion(+), 1 deletion(-)

>>

>> diff --git a/drivers/cpufreq/scmi-cpufreq.c b/drivers/cpufreq/scmi-cpufreq.c

>> index ec9a87ca2dbb..75f818d04b48 100644

>> --- a/drivers/cpufreq/scmi-cpufreq.c

>> +++ b/drivers/cpufreq/scmi-cpufreq.c

>> @@ -134,7 +134,7 @@ static int scmi_cpufreq_init(struct cpufreq_policy *policy)

>>   	}

>>   

>>   	if (!zalloc_cpumask_var(&opp_shared_cpus, GFP_KERNEL))

>> -		ret = -ENOMEM;

>> +		return -ENOMEM;

>>   

>>   	/* Obtain CPUs that share SCMI performance controls */

>>   	ret = scmi_get_sharing_cpus(cpu_dev, policy->cpus);

> 

> Applied. Thanks.

> 


Thank you for taking it.
diff mbox series

Patch

diff --git a/drivers/cpufreq/scmi-cpufreq.c b/drivers/cpufreq/scmi-cpufreq.c
index ec9a87ca2dbb..75f818d04b48 100644
--- a/drivers/cpufreq/scmi-cpufreq.c
+++ b/drivers/cpufreq/scmi-cpufreq.c
@@ -134,7 +134,7 @@  static int scmi_cpufreq_init(struct cpufreq_policy *policy)
 	}
 
 	if (!zalloc_cpumask_var(&opp_shared_cpus, GFP_KERNEL))
-		ret = -ENOMEM;
+		return -ENOMEM;
 
 	/* Obtain CPUs that share SCMI performance controls */
 	ret = scmi_get_sharing_cpus(cpu_dev, policy->cpus);