From: Alex Hung <alex.h...@amd.com>

[Why & How]
amdgpu_dm_find_first_crtc_matching_connector can return NULL.
It is necessary to the returned connector before passing it
drm_atomic_get_new_connector_state which always assumes connector is
not NULL.

Reviewed-by: Roman Li <roman...@amd.com>
Signed-off-by: Alex Hung <alex.h...@amd.com>
Signed-off-by: Wayne Lin <wayne....@amd.com>
---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c 
b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c
index 0d14a0d5def3..5c956b9962dc 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c
@@ -1631,6 +1631,9 @@ int pre_validate_dsc(struct drm_atomic_state *state,
                        connector =
                                
amdgpu_dm_find_first_crtc_matching_connector(state,
                                                                             
state->crtcs[ind].ptr);
+                       if (!connector)
+                               continue;
+
                        drm_new_conn_state =
                                drm_atomic_get_new_connector_state(state,
                                                                   connector);
-- 
2.37.3

Reply via email to