[PATCH 03/12] drm/amd/display: Add null checks

Rodrigo Siqueira Rodrigo.Siqueira at amd.com
Tue Jun 29 15:54:13 UTC 2021


From: Wang <anguwang at amd.com>

Added NULL checks before two problematic statements

Signed-off-by: Wang <anguwang at amd.com>
Reviewed-by: Martin Leung <Martin.Leung at amd.com>
Acked-by: Rodrigo Siqueira <Rodrigo.Siqueira at amd.com>
---
 drivers/gpu/drm/amd/display/dc/core/dc_stream.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_stream.c b/drivers/gpu/drm/amd/display/dc/core/dc_stream.c
index 45931ee14a6e..327fd1909c51 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc_stream.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc_stream.c
@@ -221,6 +221,9 @@ struct dc_stream_status *dc_stream_get_status_from_state(
 {
 	uint8_t i;
 
+	if (state == NULL)
+		return NULL;
+
 	for (i = 0; i < state->stream_count; i++) {
 		if (stream == state->streams[i])
 			return &state->stream_status[i];
-- 
2.25.1



More information about the amd-gfx mailing list