]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drm/amd/display: Skip plane when not found by stream id
authorAlex Hung <alex.hung@amd.com>
Fri, 26 Apr 2024 16:02:55 +0000 (10:02 -0600)
committerAlex Deucher <alexander.deucher@amd.com>
Thu, 2 May 2024 20:18:18 +0000 (16:18 -0400)
[Why & How]
dml_stream_idx will be -1 when it is not found. Check and skip in such a
case as -1 is not a valid array index.

This fixes a NEGATIVE_RETURNS issue reported by Coverity.

Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Acked-by: Tom Chung <chiahsuan.chung@amd.com>
Signed-off-by: Alex Hung <alex.hung@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/dc/dml2/dml21/dml21_utils.c

index aa0cc4bb2b474d0e4e14f524871969b848c8f5d2..8c9e95b25eb30055b1b0cd055c64ecfcb21e5f4c 100644 (file)
@@ -465,7 +465,10 @@ void dml21_build_fams2_programming(const struct dc *dc,
                }
 
                dml_stream_idx = dml21_helper_find_dml_pipe_idx_by_stream_id(dml_ctx, stream->stream_id);
-               ASSERT(dml_stream_idx >= 0);
+               if (dml_stream_idx < 0) {
+                       ASSERT(dml_stream_idx >= 0);
+                       continue;
+               }
 
                /* copy static state from PMO */
                memcpy(static_state,