aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Hung <[email protected]>2024-04-26 10:02:55 -0600
committerAlex Deucher <[email protected]>2024-05-02 16:18:18 -0400
commitecda00059b14b95a5b84f3efc1c1f341e1fd7dbc (patch)
tree7fea19824eec1d21b6eca117d64686a8cc29caf8
parent9d25ac51f5bc952a4454bad9c0d0ca09c3827003 (diff)
drm/amd/display: Skip plane when not found by stream id
[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 <[email protected]> Acked-by: Tom Chung <[email protected]> Signed-off-by: Alex Hung <[email protected]> Tested-by: Daniel Wheeler <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
-rw-r--r--drivers/gpu/drm/amd/display/dc/dml2/dml21/dml21_utils.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/gpu/drm/amd/display/dc/dml2/dml21/dml21_utils.c b/drivers/gpu/drm/amd/display/dc/dml2/dml21/dml21_utils.c
index aa0cc4bb2b47..8c9e95b25eb3 100644
--- a/drivers/gpu/drm/amd/display/dc/dml2/dml21/dml21_utils.c
+++ b/drivers/gpu/drm/amd/display/dc/dml2/dml21/dml21_utils.c
@@ -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,