[PATCH 11/24] drm/amd/display: Add NULL check within get_target_mpc_factor

Roman.Li at amd.com Roman.Li at amd.com
Thu May 16 19:26:34 UTC 2024


From: Hersen Wu <hersenxs.wu at amd.com>

[Why] Coverity reports NULL_RETURN warning.

[How] Add pointer NULL check.

Reviewed-by: Rodrigo Siqueira <Rodrigo.Siqueira at amd.com>
Signed-off-by: Hersen Wu <hersenxs.wu at amd.com>
---
 .../gpu/drm/amd/display/dc/dml2/dml2_dc_resource_mgmt.c  | 9 +++++++++
 1 file changed, 9 insertions(+)

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 190fa2962271..02fb2cb1c43c 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
@@ -819,7 +819,16 @@ static unsigned int get_target_mpc_factor(struct dml2_context *ctx,
 
 			/* get stream id of main stream */
 			main_stream = ctx->config.svp_pstate.callbacks.get_paired_subvp_stream(state, stream);
+			if (!main_stream) {
+				ASSERT(false);
+				return 1;
+			}
+
 			main_stream_status = ctx->config.callbacks.get_stream_status(state, main_stream);
+			if (!main_stream_status) {
+				ASSERT(false);
+				return 1;
+			}
 
 			/* get plane id for associated main plane */
 			get_plane_id(ctx, state, main_stream_status->plane_states[plane_idx],
-- 
2.34.1



More information about the amd-gfx mailing list