linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] cpufreq: imx: fix regulator_get error handling
@ 2015-10-18 11:01 Heiner Kallweit
  2015-10-18 15:55 ` Viresh Kumar
  2015-10-18 16:46 ` Viresh Kumar
  0 siblings, 2 replies; 4+ messages in thread
From: Heiner Kallweit @ 2015-10-18 11:01 UTC (permalink / raw)
  To: Viresh Kumar, Rafael J. Wysocki; +Cc: linux-pm

With CONFIG_DELAY_DEVICE_PROBES being set I get the following error:

cpu cpu0: failed to get regulators
imx6q-cpufreq: probe of imx6q-cpufreq.0 failed with error -2

Fix the error handling of regulator_get to properly deal
with -EPROBE_DEFER.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
 drivers/cpufreq/imx6q-cpufreq.c | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/drivers/cpufreq/imx6q-cpufreq.c b/drivers/cpufreq/imx6q-cpufreq.c
index 380a90d..0bb33dc 100644
--- a/drivers/cpufreq/imx6q-cpufreq.c
+++ b/drivers/cpufreq/imx6q-cpufreq.c
@@ -187,11 +187,20 @@ static int imx6q_cpufreq_probe(struct platform_device *pdev)
 	}
 
 	arm_reg = regulator_get(cpu_dev, "arm");
+	if (IS_ERR(arm_reg)) {
+		ret = PTR_ERR(arm_reg);
+		if (ret != -EPROBE_DEFER)
+			dev_err(cpu_dev, "failed to get regulator arm\n");
+		goto put_reg;
+	}
+
 	pu_reg = regulator_get_optional(cpu_dev, "pu");
+
 	soc_reg = regulator_get(cpu_dev, "soc");
-	if (IS_ERR(arm_reg) || IS_ERR(soc_reg)) {
-		dev_err(cpu_dev, "failed to get regulators\n");
-		ret = -ENOENT;
+	if (IS_ERR(soc_reg)) {
+		ret = PTR_ERR(soc_reg);
+		if (ret != -EPROBE_DEFER)
+			dev_err(cpu_dev, "failed to get regulator soc\n");
 		goto put_reg;
 	}
 
-- 
2.6.1


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

* Re: [PATCH 1/2] cpufreq: imx: fix regulator_get error handling
  2015-10-18 11:01 [PATCH 1/2] cpufreq: imx: fix regulator_get error handling Heiner Kallweit
@ 2015-10-18 15:55 ` Viresh Kumar
  2015-10-18 16:40   ` Heiner Kallweit
  2015-10-18 16:46 ` Viresh Kumar
  1 sibling, 1 reply; 4+ messages in thread
From: Viresh Kumar @ 2015-10-18 15:55 UTC (permalink / raw)
  To: Heiner Kallweit; +Cc: Rafael J. Wysocki, linux-pm

On 18-10-15, 13:01, Heiner Kallweit wrote:
>  	arm_reg = regulator_get(cpu_dev, "arm");
> +	if (IS_ERR(arm_reg)) {
> +		ret = PTR_ERR(arm_reg);
> +		if (ret != -EPROBE_DEFER)
> +			dev_err(cpu_dev, "failed to get regulator arm\n");
> +		goto put_reg;

So you will error out even for other errors, but that wasn't the case
earlier. Are you sure this is what you want?

> +	}
> +
>  	pu_reg = regulator_get_optional(cpu_dev, "pu");

Why don't we do error checking for this as well ?

> +
>  	soc_reg = regulator_get(cpu_dev, "soc");
> -	if (IS_ERR(arm_reg) || IS_ERR(soc_reg)) {
> -		dev_err(cpu_dev, "failed to get regulators\n");
> -		ret = -ENOENT;
> +	if (IS_ERR(soc_reg)) {
> +		ret = PTR_ERR(soc_reg);
> +		if (ret != -EPROBE_DEFER)
> +			dev_err(cpu_dev, "failed to get regulator soc\n");
>  		goto put_reg;
>  	}
>  
> -- 
> 2.6.1

-- 
viresh

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

* Re: [PATCH 1/2] cpufreq: imx: fix regulator_get error handling
  2015-10-18 15:55 ` Viresh Kumar
@ 2015-10-18 16:40   ` Heiner Kallweit
  0 siblings, 0 replies; 4+ messages in thread
From: Heiner Kallweit @ 2015-10-18 16:40 UTC (permalink / raw)
  To: Viresh Kumar; +Cc: Rafael J. Wysocki, linux-pm

Am 18.10.2015 um 17:55 schrieb Viresh Kumar:
> On 18-10-15, 13:01, Heiner Kallweit wrote:
>>  	arm_reg = regulator_get(cpu_dev, "arm");
>> +	if (IS_ERR(arm_reg)) {
>> +		ret = PTR_ERR(arm_reg);
>> +		if (ret != -EPROBE_DEFER)
>> +			dev_err(cpu_dev, "failed to get regulator arm\n");
>> +		goto put_reg;
> 
> So you will error out even for other errors, but that wasn't the case
> earlier. Are you sure this is what you want?
> 
This was the case before as well (just the error handling for
arm-reg and soc_reg was combined).
The only difference is that before all errors were mapped to
-ENOENT and now the actual error code is forwarded.

>> +	}
>> +
>>  	pu_reg = regulator_get_optional(cpu_dev, "pu");
> 
> Why don't we do error checking for this as well ?
> 
Please see patch 2/2. I separated it because it doeas a little bit
more than handling -EPROBE_DEFER.

>> +
>>  	soc_reg = regulator_get(cpu_dev, "soc");
>> -	if (IS_ERR(arm_reg) || IS_ERR(soc_reg)) {
>> -		dev_err(cpu_dev, "failed to get regulators\n");
>> -		ret = -ENOENT;
>> +	if (IS_ERR(soc_reg)) {
>> +		ret = PTR_ERR(soc_reg);
>> +		if (ret != -EPROBE_DEFER)
>> +			dev_err(cpu_dev, "failed to get regulator soc\n");
>>  		goto put_reg;
>>  	}
>>  
>> -- 
>> 2.6.1
> 


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

* Re: [PATCH 1/2] cpufreq: imx: fix regulator_get error handling
  2015-10-18 11:01 [PATCH 1/2] cpufreq: imx: fix regulator_get error handling Heiner Kallweit
  2015-10-18 15:55 ` Viresh Kumar
@ 2015-10-18 16:46 ` Viresh Kumar
  1 sibling, 0 replies; 4+ messages in thread
From: Viresh Kumar @ 2015-10-18 16:46 UTC (permalink / raw)
  To: Heiner Kallweit; +Cc: Rafael J. Wysocki, linux-pm

On 18-10-15, 13:01, Heiner Kallweit wrote:
> With CONFIG_DELAY_DEVICE_PROBES being set I get the following error:
> 
> cpu cpu0: failed to get regulators
> imx6q-cpufreq: probe of imx6q-cpufreq.0 failed with error -2
> 
> Fix the error handling of regulator_get to properly deal
> with -EPROBE_DEFER.
> 
> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
> ---
>  drivers/cpufreq/imx6q-cpufreq.c | 15 ++++++++++++---
>  1 file changed, 12 insertions(+), 3 deletions(-)

For both patches.

Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
-- 
viresh

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

end of thread, other threads:[~2015-10-18 16:46 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-18 11:01 [PATCH 1/2] cpufreq: imx: fix regulator_get error handling Heiner Kallweit
2015-10-18 15:55 ` Viresh Kumar
2015-10-18 16:40   ` Heiner Kallweit
2015-10-18 16:46 ` Viresh Kumar

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