diff mbox series

[v3,01/12] opp: Fix adding OPP entries in a wrong order if rate is unavailable

Message ID 20210118005524.27787-2-digetx@gmail.com (mailing list archive)
State New
Delegated to: viresh kumar
Headers show
Series OPP API fixes and improvements | expand

Commit Message

Dmitry Osipenko Jan. 18, 2021, 12:55 a.m. UTC
Fix adding OPP entries in a wrong (opposite) order if OPP rate is
unavailable. The OPP comparison was erroneously skipped, thus OPPs
were left unsorted.

Tested-by: Peter Geis <pgwipeout@gmail.com>
Tested-by: Nicolas Chauvet <kwizart@gmail.com>
Tested-by: Matt Merhar <mattmerhar@protonmail.com>
Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
---
 drivers/opp/core.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

Comments

Viresh Kumar Jan. 18, 2021, 7:44 a.m. UTC | #1
On 18-01-21, 03:55, Dmitry Osipenko wrote:
> Fix adding OPP entries in a wrong (opposite) order if OPP rate is
> unavailable. The OPP comparison was erroneously skipped, thus OPPs
> were left unsorted.
> 
> Tested-by: Peter Geis <pgwipeout@gmail.com>
> Tested-by: Nicolas Chauvet <kwizart@gmail.com>
> Tested-by: Matt Merhar <mattmerhar@protonmail.com>
> Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
> ---
>  drivers/opp/core.c | 10 ++++------
>  1 file changed, 4 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/opp/core.c b/drivers/opp/core.c
> index dfc4208d3f87..48618ff3e99e 100644
> --- a/drivers/opp/core.c
> +++ b/drivers/opp/core.c
> @@ -1527,12 +1527,10 @@ int _opp_add(struct device *dev, struct dev_pm_opp *new_opp,
>  	mutex_lock(&opp_table->lock);
>  	head = &opp_table->opp_list;
>  
> -	if (likely(!rate_not_available)) {
> -		ret = _opp_is_duplicate(dev, new_opp, opp_table, &head);
> -		if (ret) {
> -			mutex_unlock(&opp_table->lock);
> -			return ret;
> -		}
> +	ret = _opp_is_duplicate(dev, new_opp, opp_table, &head);
> +	if (ret) {
> +		mutex_unlock(&opp_table->lock);
> +		return ret;
>  	}
>  
>  	list_add(&new_opp->node, head);

Applied. Thanks.

I am not sending it for 5.11-rc as there shouldn't be any users which
are impacted because of this right now, right ?
Dmitry Osipenko Jan. 18, 2021, 6:46 p.m. UTC | #2
18.01.2021 10:44, Viresh Kumar пишет:
> On 18-01-21, 03:55, Dmitry Osipenko wrote:
>> Fix adding OPP entries in a wrong (opposite) order if OPP rate is
>> unavailable. The OPP comparison was erroneously skipped, thus OPPs
>> were left unsorted.
>>
>> Tested-by: Peter Geis <pgwipeout@gmail.com>
>> Tested-by: Nicolas Chauvet <kwizart@gmail.com>
>> Tested-by: Matt Merhar <mattmerhar@protonmail.com>
>> Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
>> ---
>>  drivers/opp/core.c | 10 ++++------
>>  1 file changed, 4 insertions(+), 6 deletions(-)
>>
>> diff --git a/drivers/opp/core.c b/drivers/opp/core.c
>> index dfc4208d3f87..48618ff3e99e 100644
>> --- a/drivers/opp/core.c
>> +++ b/drivers/opp/core.c
>> @@ -1527,12 +1527,10 @@ int _opp_add(struct device *dev, struct dev_pm_opp *new_opp,
>>  	mutex_lock(&opp_table->lock);
>>  	head = &opp_table->opp_list;
>>  
>> -	if (likely(!rate_not_available)) {
>> -		ret = _opp_is_duplicate(dev, new_opp, opp_table, &head);
>> -		if (ret) {
>> -			mutex_unlock(&opp_table->lock);
>> -			return ret;
>> -		}
>> +	ret = _opp_is_duplicate(dev, new_opp, opp_table, &head);
>> +	if (ret) {
>> +		mutex_unlock(&opp_table->lock);
>> +		return ret;
>>  	}
>>  
>>  	list_add(&new_opp->node, head);
> 
> Applied. Thanks.
> 
> I am not sending it for 5.11-rc as there shouldn't be any users which
> are impacted because of this right now, right ?
> 

right
diff mbox series

Patch

diff --git a/drivers/opp/core.c b/drivers/opp/core.c
index dfc4208d3f87..48618ff3e99e 100644
--- a/drivers/opp/core.c
+++ b/drivers/opp/core.c
@@ -1527,12 +1527,10 @@  int _opp_add(struct device *dev, struct dev_pm_opp *new_opp,
 	mutex_lock(&opp_table->lock);
 	head = &opp_table->opp_list;
 
-	if (likely(!rate_not_available)) {
-		ret = _opp_is_duplicate(dev, new_opp, opp_table, &head);
-		if (ret) {
-			mutex_unlock(&opp_table->lock);
-			return ret;
-		}
+	ret = _opp_is_duplicate(dev, new_opp, opp_table, &head);
+	if (ret) {
+		mutex_unlock(&opp_table->lock);
+		return ret;
 	}
 
 	list_add(&new_opp->node, head);