[PATCH] drm/amd/display: remove redundant check

José Pekkarinen posted 1 patch 2 years, 2 months ago
There is a newer version of this series
.../drm/amd/display/dc/dml/dcn32/display_mode_vba_util_32.c   | 4 ----
1 file changed, 4 deletions(-)
[PATCH] drm/amd/display: remove redundant check
Posted by José Pekkarinen 2 years, 2 months ago
This patch addresses the following warning spotted by
using coccinelle where the case checked does the same
than the else case.

drivers/gpu/drm/amd/display/dc/dml/dcn32/display_mode_vba_util_32.c:4664:8-10: WARNING: possible condition with no effect (if == else)

Signed-off-by: José Pekkarinen <jose.pekkarinen@foxhound.fi>
---
 .../drm/amd/display/dc/dml/dcn32/display_mode_vba_util_32.c   | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/dc/dml/dcn32/display_mode_vba_util_32.c b/drivers/gpu/drm/amd/display/dc/dml/dcn32/display_mode_vba_util_32.c
index ecea008f19d3..d940dfa5ae43 100644
--- a/drivers/gpu/drm/amd/display/dc/dml/dcn32/display_mode_vba_util_32.c
+++ b/drivers/gpu/drm/amd/display/dc/dml/dcn32/display_mode_vba_util_32.c
@@ -4661,10 +4661,6 @@ void dml32_CalculateMinAndMaxPrefetchMode(
 	} else if (AllowForPStateChangeOrStutterInVBlankFinal == dm_prefetch_support_uclk_fclk_and_stutter) {
 		*MinPrefetchMode = 0;
 		*MaxPrefetchMode = 0;
-	} else if (AllowForPStateChangeOrStutterInVBlankFinal ==
-			dm_prefetch_support_uclk_fclk_and_stutter_if_possible) {
-		*MinPrefetchMode = 0;
-		*MaxPrefetchMode = 3;
 	} else {
 		*MinPrefetchMode = 0;
 		*MaxPrefetchMode = 3;
-- 
2.39.2

Re: [PATCH] drm/amd/display: remove redundant check
Posted by Aurabindo Pillai 2 years, 2 months ago

On 10/29/2023 8:44 AM, José Pekkarinen wrote:
> This patch addresses the following warning spotted by
> using coccinelle where the case checked does the same
> than the else case.
> 
> drivers/gpu/drm/amd/display/dc/dml/dcn32/display_mode_vba_util_32.c:4664:8-10: WARNING: possible condition with no effect (if == else)
> 
> Signed-off-by: José Pekkarinen <jose.pekkarinen@foxhound.fi>
> ---
>   .../drm/amd/display/dc/dml/dcn32/display_mode_vba_util_32.c   | 4 ----
>   1 file changed, 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/amd/display/dc/dml/dcn32/display_mode_vba_util_32.c b/drivers/gpu/drm/amd/display/dc/dml/dcn32/display_mode_vba_util_32.c
> index ecea008f19d3..d940dfa5ae43 100644
> --- a/drivers/gpu/drm/amd/display/dc/dml/dcn32/display_mode_vba_util_32.c
> +++ b/drivers/gpu/drm/amd/display/dc/dml/dcn32/display_mode_vba_util_32.c
> @@ -4661,10 +4661,6 @@ void dml32_CalculateMinAndMaxPrefetchMode(
>   	} else if (AllowForPStateChangeOrStutterInVBlankFinal == dm_prefetch_support_uclk_fclk_and_stutter) {
>   		*MinPrefetchMode = 0;
>   		*MaxPrefetchMode = 0;
> -	} else if (AllowForPStateChangeOrStutterInVBlankFinal ==
> -			dm_prefetch_support_uclk_fclk_and_stutter_if_possible) {
> -		*MinPrefetchMode = 0;
> -		*MaxPrefetchMode = 3;
>   	} else {
>   		*MinPrefetchMode = 0;
>   		*MaxPrefetchMode = 3;

What tree did you use to generate the patch? On amd-staging-drm-next, 
MaxPrefetchMode is 0 for the second last branch, which is the correct 
one, so this patch isnt needed.
Re: [PATCH] drm/amd/display: remove redundant check
Posted by José Pekkarinen 2 years, 2 months ago
On 2023-10-30 15:52, Aurabindo Pillai wrote:
> On 10/29/2023 8:44 AM, José Pekkarinen wrote:
>> This patch addresses the following warning spotted by
>> using coccinelle where the case checked does the same
>> than the else case.
>> 
>> drivers/gpu/drm/amd/display/dc/dml/dcn32/display_mode_vba_util_32.c:4664:8-10: 
>> WARNING: possible condition with no effect (if == else)
>> 
>> Signed-off-by: José Pekkarinen <jose.pekkarinen@foxhound.fi>
>> ---
>>   .../drm/amd/display/dc/dml/dcn32/display_mode_vba_util_32.c   | 4 
>> ----
>>   1 file changed, 4 deletions(-)
>> 
>> diff --git 
>> a/drivers/gpu/drm/amd/display/dc/dml/dcn32/display_mode_vba_util_32.c 
>> b/drivers/gpu/drm/amd/display/dc/dml/dcn32/display_mode_vba_util_32.c
>> index ecea008f19d3..d940dfa5ae43 100644
>> --- 
>> a/drivers/gpu/drm/amd/display/dc/dml/dcn32/display_mode_vba_util_32.c
>> +++ 
>> b/drivers/gpu/drm/amd/display/dc/dml/dcn32/display_mode_vba_util_32.c
>> @@ -4661,10 +4661,6 @@ void dml32_CalculateMinAndMaxPrefetchMode(
>>   	} else if (AllowForPStateChangeOrStutterInVBlankFinal == 
>> dm_prefetch_support_uclk_fclk_and_stutter) {
>>   		*MinPrefetchMode = 0;
>>   		*MaxPrefetchMode = 0;
>> -	} else if (AllowForPStateChangeOrStutterInVBlankFinal ==
>> -			dm_prefetch_support_uclk_fclk_and_stutter_if_possible) {
>> -		*MinPrefetchMode = 0;
>> -		*MaxPrefetchMode = 3;
>>   	} else {
>>   		*MinPrefetchMode = 0;
>>   		*MaxPrefetchMode = 3;
> 
> What tree did you use to generate the patch? On amd-staging-drm-next,
> MaxPrefetchMode is 0 for the second last branch, which is the correct
> one, so this patch isnt needed.

     I'm using the stable tree, sorry, if it is out of
date just ignore it then.

     Thanks!

     José.
Re: [PATCH] drm/amd/display: remove redundant check
Posted by Aurabindo Pillai 2 years, 2 months ago

On 2023-10-30 12:26, José Pekkarinen wrote:
> On 2023-10-30 15:52, Aurabindo Pillai wrote:
>> On 10/29/2023 8:44 AM, José Pekkarinen wrote:
>>> This patch addresses the following warning spotted by
>>> using coccinelle where the case checked does the same
>>> than the else case.
>>>
>>> drivers/gpu/drm/amd/display/dc/dml/dcn32/display_mode_vba_util_32.c:4664:8-10: WARNING: possible condition with no effect (if == else)
>>>
>>> Signed-off-by: José Pekkarinen <jose.pekkarinen@foxhound.fi>
>>> ---
>>>   .../drm/amd/display/dc/dml/dcn32/display_mode_vba_util_32.c   | 4 ----
>>>   1 file changed, 4 deletions(-)
>>>
>>> diff --git 
>>> a/drivers/gpu/drm/amd/display/dc/dml/dcn32/display_mode_vba_util_32.c 
>>> b/drivers/gpu/drm/amd/display/dc/dml/dcn32/display_mode_vba_util_32.c
>>> index ecea008f19d3..d940dfa5ae43 100644
>>> --- 
>>> a/drivers/gpu/drm/amd/display/dc/dml/dcn32/display_mode_vba_util_32.c
>>> +++ 
>>> b/drivers/gpu/drm/amd/display/dc/dml/dcn32/display_mode_vba_util_32.c
>>> @@ -4661,10 +4661,6 @@ void dml32_CalculateMinAndMaxPrefetchMode(
>>>       } else if (AllowForPStateChangeOrStutterInVBlankFinal == 
>>> dm_prefetch_support_uclk_fclk_and_stutter) {
>>>           *MinPrefetchMode = 0;
>>>           *MaxPrefetchMode = 0;
>>> -    } else if (AllowForPStateChangeOrStutterInVBlankFinal ==
>>> -            dm_prefetch_support_uclk_fclk_and_stutter_if_possible) {
>>> -        *MinPrefetchMode = 0;
>>> -        *MaxPrefetchMode = 3;
>>>       } else {
>>>           *MinPrefetchMode = 0;
>>>           *MaxPrefetchMode = 3;
>>
>> What tree did you use to generate the patch? On amd-staging-drm-next,
>> MaxPrefetchMode is 0 for the second last branch, which is the correct
>> one, so this patch isnt needed.
> 
>      I'm using the stable tree, sorry, if it is out of
> date just ignore it then.
> 
>      Thanks!
> 
>      José.
Actually, you're right - the patch's limited context mislead me, sorry.
But please add the following tag and sent it to stable@vger.kernel.org 
instead:

Fixes: 974ce181 ("drm/amd/display: Add check for PState change in DCN32")