[PATCH] drm/amd/display: Simplify unnecessary if-else conditions

Liao Yuanhong liaoyuanhong at vivo.com
Mon Aug 18 06:40:09 UTC 2025


Some simple if-else logic can be simplified using the ! operator to improve
code readability.

Signed-off-by: Liao Yuanhong <liaoyuanhong at vivo.com>
---
 .../gpu/drm/amd/display/dc/dml2/dml2_dc_resource_mgmt.c    | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/dc/dml2/dml2_dc_resource_mgmt.c b/drivers/gpu/drm/amd/display/dc/dml2/dml2_dc_resource_mgmt.c
index 5f1b49a50049..45867d1475fa 100644
--- a/drivers/gpu/drm/amd/display/dc/dml2/dml2_dc_resource_mgmt.c
+++ b/drivers/gpu/drm/amd/display/dc/dml2/dml2_dc_resource_mgmt.c
@@ -500,12 +500,7 @@ static void sort_pipes_for_splitting(struct dc_plane_pipe_pool *pipes)
 
 			if (cur_index == pipes->num_pipes_assigned_to_plane_for_mpcc_combine - 1) {
 				cur_index = 0;
-
-				if (swapped)
-					sorted = false;
-				else
-					sorted = true;
-
+				sorted = !swapped;
 				swapped = false;
 			}
 
-- 
2.34.1



More information about the amd-gfx mailing list