diff mbox series

opp: fix bad error check logic in the opp helper register

Message ID 20201028141357.10345-1-t-kristo@ti.com
State New
Headers show
Series opp: fix bad error check logic in the opp helper register | expand

Commit Message

Tero Kristo Oct. 28, 2020, 2:13 p.m. UTC
The error check is incorrectly negated causing the helper to never
register anything. This causes platforms that depend on this
functionality to fail always with any cpufreq transition, and at least
TI DRA7 based platforms fail to boot completely due to warning message
flood from _generic_set_opp_regulator complaining about multiple
regulators not being supported.

Fixes: dd461cd9183f ("opp: Allow dev_pm_opp_get_opp_table() to return -EPROBE_DEFER")
Signed-off-by: Tero Kristo <t-kristo@ti.com>
---
 drivers/opp/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Viresh Kumar Oct. 28, 2020, 2:54 p.m. UTC | #1
On 28-10-20, 16:13, Tero Kristo wrote:
> The error check is incorrectly negated causing the helper to never
> register anything. This causes platforms that depend on this
> functionality to fail always with any cpufreq transition, and at least
> TI DRA7 based platforms fail to boot completely due to warning message
> flood from _generic_set_opp_regulator complaining about multiple
> regulators not being supported.
> 
> Fixes: dd461cd9183f ("opp: Allow dev_pm_opp_get_opp_table() to return -EPROBE_DEFER")
> Signed-off-by: Tero Kristo <t-kristo@ti.com>
> ---
>  drivers/opp/core.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/opp/core.c b/drivers/opp/core.c
> index 2483e765318a..4ac4e7ce6b8b 100644
> --- a/drivers/opp/core.c
> +++ b/drivers/opp/core.c
> @@ -1930,7 +1930,7 @@ struct opp_table *dev_pm_opp_register_set_opp_helper(struct device *dev,
>  		return ERR_PTR(-EINVAL);
>  
>  	opp_table = dev_pm_opp_get_opp_table(dev);
> -	if (!IS_ERR(opp_table))
> +	if (IS_ERR(opp_table))
>  		return opp_table;
>  
>  	/* This should be called before OPPs are initialized */

A similar fix is already pushed in linux-next for this.
Tero Kristo Oct. 28, 2020, 3:28 p.m. UTC | #2
On 28/10/2020 16:54, Viresh Kumar wrote:
> On 28-10-20, 16:13, Tero Kristo wrote:
>> The error check is incorrectly negated causing the helper to never
>> register anything. This causes platforms that depend on this
>> functionality to fail always with any cpufreq transition, and at least
>> TI DRA7 based platforms fail to boot completely due to warning message
>> flood from _generic_set_opp_regulator complaining about multiple
>> regulators not being supported.
>>
>> Fixes: dd461cd9183f ("opp: Allow dev_pm_opp_get_opp_table() to return -EPROBE_DEFER")
>> Signed-off-by: Tero Kristo <t-kristo@ti.com>
>> ---
>>   drivers/opp/core.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/opp/core.c b/drivers/opp/core.c
>> index 2483e765318a..4ac4e7ce6b8b 100644
>> --- a/drivers/opp/core.c
>> +++ b/drivers/opp/core.c
>> @@ -1930,7 +1930,7 @@ struct opp_table *dev_pm_opp_register_set_opp_helper(struct device *dev,
>>   		return ERR_PTR(-EINVAL);
>>   
>>   	opp_table = dev_pm_opp_get_opp_table(dev);
>> -	if (!IS_ERR(opp_table))
>> +	if (IS_ERR(opp_table))
>>   		return opp_table;
>>   
>>   	/* This should be called before OPPs are initialized */
> 
> A similar fix is already pushed in linux-next for this.

Ah ok, good to hear. Just checked linux-next and I see the fix also, 
sorry for the noise.

-Tero

--
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
diff mbox series

Patch

diff --git a/drivers/opp/core.c b/drivers/opp/core.c
index 2483e765318a..4ac4e7ce6b8b 100644
--- a/drivers/opp/core.c
+++ b/drivers/opp/core.c
@@ -1930,7 +1930,7 @@  struct opp_table *dev_pm_opp_register_set_opp_helper(struct device *dev,
 		return ERR_PTR(-EINVAL);
 
 	opp_table = dev_pm_opp_get_opp_table(dev);
-	if (!IS_ERR(opp_table))
+	if (IS_ERR(opp_table))
 		return opp_table;
 
 	/* This should be called before OPPs are initialized */