drm/amd/display: add protection in link encoder matching logic
authorMartin Tsai <martin.tsai@amd.com>
Sun, 23 Jan 2022 18:19:58 +0000 (13:19 -0500)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 25 Jan 2022 23:00:34 +0000 (18:00 -0500)
commitd715c9a2cbd4b5dbf72bec82b033698db3c6eca5
treef054d823a566aa6f5254a3cd2df25b8522d59f70
parent09ece5ac397f8e3539ea9ffb776e1cc6702acb9a
drm/amd/display: add protection in link encoder matching logic

[Why]
Link encoders are created based on its engine ID. The position of a link
encoder in an array could be null since it didn't be allocated.  Current
matching logic didn't consider this situation and could get null
encoder.

[How]
To add null encoder check to make the matching logic can go to next to
get a valid one.

Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Reviewed-by: Aric Cyr <Aric.Cyr@amd.com>
Acked-by: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
Signed-off-by: Martin Tsai <martin.tsai@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
drivers/gpu/drm/amd/display/dc/core/dc_link.c
drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c
drivers/gpu/drm/amd/display/dc/core/dc_link_enc_cfg.c
drivers/gpu/drm/amd/display/dc/core/dc_link_hwss.c
drivers/gpu/drm/amd/display/dc/inc/dc_link_dp.h
drivers/gpu/drm/amd/display/dc/inc/link_enc_cfg.h