]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
drm/amd/display: Simplify if conditions
authorThorsten Blum <thorsten.blum@toblux.com>
Tue, 4 Jun 2024 10:37:37 +0000 (12:37 +0200)
committerAlex Deucher <alexander.deucher@amd.com>
Fri, 14 Jun 2024 19:20:47 +0000 (15:20 -0400)
The if conditions !A || A && B can be simplified to !A || B.

Fixes the following Coccinelle/coccicheck warnings reported by
excluded_middle.cocci:

WARNING !A || A && B is equivalent to !A || B
WARNING !A || A && B is equivalent to !A || B
WARNING !A || A && B is equivalent to !A || B

Compile-tested only.

Signed-off-by: Thorsten Blum <thorsten.blum@toblux.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/dc/dml2/dml2_dc_resource_mgmt.c
drivers/gpu/drm/amd/display/dc/dml2/dml2_translation_helper.c

index 02fb2cb1c43c0ecbbb73a7f8486b07c9b1fa69cd..23ffecfd70eb31c9aae82a443f7d4ec74aa1c0b8 100644 (file)
@@ -68,7 +68,7 @@ static bool get_plane_id(struct dml2_context *dml2, const struct dc_state *state
                if (state->streams[i]->stream_id == stream_id) {
                        for (j = 0; j < state->stream_status[i].plane_count; j++) {
                                if (state->stream_status[i].plane_states[j] == plane &&
-                                       (!is_plane_duplicate || (is_plane_duplicate && (j == plane_index)))) {
+                                       (!is_plane_duplicate || (j == plane_index))) {
                                        *plane_id = (i << 16) | j;
                                        return true;
                                }
@@ -707,8 +707,8 @@ static void free_unused_pipes_for_plane(struct dml2_context *ctx, struct dc_stat
        for (i = 0; i < ctx->config.dcn_pipe_count; i++) {
                if (state->res_ctx.pipe_ctx[i].plane_state == plane &&
                        state->res_ctx.pipe_ctx[i].stream->stream_id == stream_id &&
-                       (!is_plane_duplicate || (is_plane_duplicate &&
-                       ctx->v20.scratch.dml_to_dc_pipe_mapping.dml_pipe_idx_to_plane_index[state->res_ctx.pipe_ctx[i].pipe_idx] == plane_index)) &&
+                       (!is_plane_duplicate ||
+                       ctx->v20.scratch.dml_to_dc_pipe_mapping.dml_pipe_idx_to_plane_index[state->res_ctx.pipe_ctx[i].pipe_idx] == plane_index) &&
                        !is_pipe_used(pool, state->res_ctx.pipe_ctx[i].pipe_idx)) {
                        free_pipe(&state->res_ctx.pipe_ctx[i]);
                }
index c04ebf5434c98fc5123b070b22bca0aaf7c3026c..8a8e35cd30c2b808a649afce8e0df191a255d40e 100644 (file)
@@ -1109,7 +1109,7 @@ static bool get_plane_id(struct dml2_context *dml2, const struct dc_state *conte
                if (context->streams[i]->stream_id == stream_id) {
                        for (j = 0; j < context->stream_status[i].plane_count; j++) {
                                if (context->stream_status[i].plane_states[j] == plane &&
-                                       (!is_plane_duplicate || (is_plane_duplicate && (j == plane_index)))) {
+                                       (!is_plane_duplicate || (j == plane_index))) {
                                        *plane_id = (i << 16) | j;
                                        return true;
                                }