drm/amd/display: Remove duplicate/repeating expressions

Message ID Y+YVy7RaxnXokJ3l@ubun2204.myguest.virtualbox.org
State New
Headers
Series drm/amd/display: Remove duplicate/repeating expressions |

Commit Message

Deepak R Varma Feb. 10, 2023, 10 a.m. UTC
  Remove duplicate or repeating expressions in the if condition
evaluation. Issue identified using doubletest.cocci Coccinelle semantic
patch.

Signed-off-by: Deepak R Varma <drv@mailo.com>
---
 .../gpu/drm/amd/display/dc/dml/dcn32/display_mode_vba_32.c    | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
  

Comments

Harry Wentland Feb. 10, 2023, 7:36 p.m. UTC | #1
On 2/10/23 05:00, Deepak R Varma wrote:
> Remove duplicate or repeating expressions in the if condition
> evaluation. Issue identified using doubletest.cocci Coccinelle semantic
> patch.
> 
> Signed-off-by: Deepak R Varma <drv@mailo.com>

Reviewed-by: Harry Wentland <harry.wentland@amd.com>

Harry

> ---
>  .../gpu/drm/amd/display/dc/dml/dcn32/display_mode_vba_32.c    | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/amd/display/dc/dml/dcn32/display_mode_vba_32.c b/drivers/gpu/drm/amd/display/dc/dml/dcn32/display_mode_vba_32.c
> index 4b8f5fa0f0ad..ae89760d887d 100644
> --- a/drivers/gpu/drm/amd/display/dc/dml/dcn32/display_mode_vba_32.c
> +++ b/drivers/gpu/drm/amd/display/dc/dml/dcn32/display_mode_vba_32.c
> @@ -2335,8 +2335,7 @@ void dml32_ModeSupportAndSystemConfigurationFull(struct display_mode_lib *mode_l
>  
>  			if (mode_lib->vba.DSCEnable[k] && mode_lib->vba.ForcedOutputLinkBPP[k] != 0)
>  				mode_lib->vba.DSCOnlyIfNecessaryWithBPP = true;
> -			if ((mode_lib->vba.DSCEnable[k] || mode_lib->vba.DSCEnable[k])
> -					&& mode_lib->vba.OutputFormat[k] == dm_n422
> +			if (mode_lib->vba.DSCEnable[k] && mode_lib->vba.OutputFormat[k] == dm_n422
>  					&& !mode_lib->vba.DSC422NativeSupport)
>  				mode_lib->vba.DSC422NativeNotSupported = true;
>  
> @@ -3639,7 +3638,6 @@ void dml32_ModeSupportAndSystemConfigurationFull(struct display_mode_lib *mode_l
>  			if (mode_lib->vba.SourcePixelFormat[k] != dm_444_64
>  					&& mode_lib->vba.SourcePixelFormat[k] != dm_444_32
>  					&& mode_lib->vba.SourcePixelFormat[k] != dm_444_16
> -					&& mode_lib->vba.SourcePixelFormat[k] != dm_444_16
>  					&& mode_lib->vba.SourcePixelFormat[k] != dm_444_8
>  					&& mode_lib->vba.SourcePixelFormat[k] != dm_rgbe) {
>  				if (mode_lib->vba.ViewportWidthChroma[k] > mode_lib->vba.SurfaceWidthC[k]
  
Alex Deucher Feb. 15, 2023, 4:24 a.m. UTC | #2
Applied.  Thanks!

Alex

On Fri, Feb 10, 2023 at 2:37 PM Harry Wentland <harry.wentland@amd.com> wrote:
>
> On 2/10/23 05:00, Deepak R Varma wrote:
> > Remove duplicate or repeating expressions in the if condition
> > evaluation. Issue identified using doubletest.cocci Coccinelle semantic
> > patch.
> >
> > Signed-off-by: Deepak R Varma <drv@mailo.com>
>
> Reviewed-by: Harry Wentland <harry.wentland@amd.com>
>
> Harry
>
> > ---
> >  .../gpu/drm/amd/display/dc/dml/dcn32/display_mode_vba_32.c    | 4 +---
> >  1 file changed, 1 insertion(+), 3 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/amd/display/dc/dml/dcn32/display_mode_vba_32.c b/drivers/gpu/drm/amd/display/dc/dml/dcn32/display_mode_vba_32.c
> > index 4b8f5fa0f0ad..ae89760d887d 100644
> > --- a/drivers/gpu/drm/amd/display/dc/dml/dcn32/display_mode_vba_32.c
> > +++ b/drivers/gpu/drm/amd/display/dc/dml/dcn32/display_mode_vba_32.c
> > @@ -2335,8 +2335,7 @@ void dml32_ModeSupportAndSystemConfigurationFull(struct display_mode_lib *mode_l
> >
> >                       if (mode_lib->vba.DSCEnable[k] && mode_lib->vba.ForcedOutputLinkBPP[k] != 0)
> >                               mode_lib->vba.DSCOnlyIfNecessaryWithBPP = true;
> > -                     if ((mode_lib->vba.DSCEnable[k] || mode_lib->vba.DSCEnable[k])
> > -                                     && mode_lib->vba.OutputFormat[k] == dm_n422
> > +                     if (mode_lib->vba.DSCEnable[k] && mode_lib->vba.OutputFormat[k] == dm_n422
> >                                       && !mode_lib->vba.DSC422NativeSupport)
> >                               mode_lib->vba.DSC422NativeNotSupported = true;
> >
> > @@ -3639,7 +3638,6 @@ void dml32_ModeSupportAndSystemConfigurationFull(struct display_mode_lib *mode_l
> >                       if (mode_lib->vba.SourcePixelFormat[k] != dm_444_64
> >                                       && mode_lib->vba.SourcePixelFormat[k] != dm_444_32
> >                                       && mode_lib->vba.SourcePixelFormat[k] != dm_444_16
> > -                                     && mode_lib->vba.SourcePixelFormat[k] != dm_444_16
> >                                       && mode_lib->vba.SourcePixelFormat[k] != dm_444_8
> >                                       && mode_lib->vba.SourcePixelFormat[k] != dm_rgbe) {
> >                               if (mode_lib->vba.ViewportWidthChroma[k] > mode_lib->vba.SurfaceWidthC[k]
>
  

Patch

diff --git a/drivers/gpu/drm/amd/display/dc/dml/dcn32/display_mode_vba_32.c b/drivers/gpu/drm/amd/display/dc/dml/dcn32/display_mode_vba_32.c
index 4b8f5fa0f0ad..ae89760d887d 100644
--- a/drivers/gpu/drm/amd/display/dc/dml/dcn32/display_mode_vba_32.c
+++ b/drivers/gpu/drm/amd/display/dc/dml/dcn32/display_mode_vba_32.c
@@ -2335,8 +2335,7 @@  void dml32_ModeSupportAndSystemConfigurationFull(struct display_mode_lib *mode_l
 
 			if (mode_lib->vba.DSCEnable[k] && mode_lib->vba.ForcedOutputLinkBPP[k] != 0)
 				mode_lib->vba.DSCOnlyIfNecessaryWithBPP = true;
-			if ((mode_lib->vba.DSCEnable[k] || mode_lib->vba.DSCEnable[k])
-					&& mode_lib->vba.OutputFormat[k] == dm_n422
+			if (mode_lib->vba.DSCEnable[k] && mode_lib->vba.OutputFormat[k] == dm_n422
 					&& !mode_lib->vba.DSC422NativeSupport)
 				mode_lib->vba.DSC422NativeNotSupported = true;
 
@@ -3639,7 +3638,6 @@  void dml32_ModeSupportAndSystemConfigurationFull(struct display_mode_lib *mode_l
 			if (mode_lib->vba.SourcePixelFormat[k] != dm_444_64
 					&& mode_lib->vba.SourcePixelFormat[k] != dm_444_32
 					&& mode_lib->vba.SourcePixelFormat[k] != dm_444_16
-					&& mode_lib->vba.SourcePixelFormat[k] != dm_444_16
 					&& mode_lib->vba.SourcePixelFormat[k] != dm_444_8
 					&& mode_lib->vba.SourcePixelFormat[k] != dm_rgbe) {
 				if (mode_lib->vba.ViewportWidthChroma[k] > mode_lib->vba.SurfaceWidthC[k]