Skip to contentSkip to conversation

cpufreq: airoha: fix probe failure with correct error check

PATCH Applied Christian Marangi 3 participants 3 messages Aug 21 – Aug 31

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cpufreq: airoha: fix probe failure with correct error check

From: Daniel Schwierzeck <[email protected]>

dev_pm_domain_attach_list() returns the number of attached PM domains on success (a positive count), or a negative error code on failure. The driver checks "if (ret)" which treats a successful attachment of one or more PM domains as an error, causing the probe to fail with return code 1.

Fix by checking "if (ret < 0)" like all other users of this API.

Fixes 84cf9e541ccc ("cpufreq: airoha: Add EN7581 CPUFreq SMCCC driver")
---
 drivers/cpufreq/airoha-cpufreq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/cpufreq/airoha-cpufreq.c +1 -1
index 3e7770860d13..8283c528d0c1 100644
@@ -64,7 +64,7 @@ static int airoha_cpufreq_probe(struct platform_device *pdev)
 	/* Attach PM for OPP */
 	ret = dev_pm_domain_attach_list(cpu_dev, &attach_data,
 					&priv->pd_list);
-	if (ret)
+	if (ret < 0)
 		goto clear_opp_config;
 
 	cpufreq_dt = platform_device_register_simple("cpufreq-dt", -1, NULL, 0);
Signature · 1 line
2.53.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 8 lines · Christian Marangi

From: Daniel Schwierzeck <[email protected]>

dev_pm_domain_attach_list() returns the number of attached PM domains on success (a positive count), or a negative error code on failure. The driver checks "if (ret)" which treats a successful attachment of one or more PM domains as an error, causing the probe to fail with return code 1.

Quoted 6 lines

Fix by checking "if (ret < 0)" like all other users of this API.

Fixes 84cf9e541ccc ("cpufreq: airoha: Add EN7581 CPUFreq SMCCC driver")
Quoted 17 lines
---
  drivers/cpufreq/airoha-cpufreq.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/cpufreq/airoha-cpufreq.c +1 -1
index 3e7770860d13..8283c528d0c1 100644
@@ -64,7 +64,7 @@ static int airoha_cpufreq_probe(struct platform_device *pdev)
  	/* Attach PM for OPP */
  	ret = dev_pm_domain_attach_list(cpu_dev, &attach_data,
  					&priv->pd_list);
-	if (ret)
+	if (ret < 0)
  		goto clear_opp_config;
 
  	cpufreq_dt = platform_device_register_simple("cpufreq-dt", -1, NULL, 0);
Signature · 2 lines
Thx and BRs,
Zhongqiu Han
maintainer Applied
#2 lore raw
In reply to Christian Marangi
Quoted 10 lines · Christian Marangi

From: Daniel Schwierzeck <[email protected]>

dev_pm_domain_attach_list() returns the number of attached PM domains on success (a positive count), or a negative error code on failure. The driver checks "if (ret)" which treats a successful attachment of one or more PM domains as an error, causing the probe to fail with return code 1.

Fix by checking "if (ret < 0)" like all other users of this API.

Quoted 7 lines
Fixes 84cf9e541ccc ("cpufreq: airoha: Add EN7581 CPUFreq SMCCC driver")
---
 drivers/cpufreq/airoha-cpufreq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Applied. Thanks.

Signature · 1 line
viresh