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

Subsystems: cpu frequency scaling framework, system control & power/management interface (scpi/scmi) message protocol drivers, the rest

STALE1834d

5 messages, 3 authors, 2021-08-04 · open the first message on its own page

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

From: Lukasz Luba <lukasz.luba@arm.com>
Date: 2021-08-03 09:08:00

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);
-- 
2.17.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

From: Sudeep Holla <hidden>
Date: 2021-08-03 22:42:53

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 <redacted>

-- 
Regards,
Sudeep

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

From: Viresh Kumar <viresh.kumar@linaro.org>
Date: 2021-08-04 04:02:58

On 03-08-21, 10:07, Lukasz Luba wrote:
quoted hunk
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

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

From: Lukasz Luba <lukasz.luba@arm.com>
Date: 2021-08-04 10:51:11


On 8/3/21 11:41 PM, Sudeep Holla wrote:
On Tue, Aug 03, 2021 at 10:07:44AM +0100, Lukasz Luba wrote:
quoted
Stop the initialization when cpumask allocation failed and return an
error.
Good catch!

Reviewed-by: Sudeep Holla <redacted>
Thank you for the review!

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

From: Lukasz Luba <lukasz.luba@arm.com>
Date: 2021-08-04 10:52:03


On 8/4/21 5:02 AM, Viresh Kumar wrote:
On 03-08-21, 10:07, Lukasz Luba wrote:
quoted
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.

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help