drm/amd/display: Fix USB4 null pointer dereference in update_psp_stream_config
authorNicholas Kazlauskas <nicholas.kazlauskas@amd.com>
Fri, 17 Dec 2021 19:18:59 +0000 (14:18 -0500)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 28 Dec 2021 21:51:24 +0000 (16:51 -0500)
commit33bb63915fee190102cae7d6576bc51a0bc342b2
tree5c0587784248e7e67ec098f9a3f0f33d67f2cb30
parent33735c1c8d0223170d79dbe166976d9cd7339c7a
drm/amd/display: Fix USB4 null pointer dereference in update_psp_stream_config

[Why]
A porting error on a previous patch left the block of code that
causes the crash from a NULL pointer dereference.

More specifically, we try to access link_enc before it's assigned in
the USB4 case in the following assignment:

config.dio_output_idx = link_enc->transmitter - TRANSMITTER_UNIPHY_A;

[How]
That assignment occurs later depending on the ASIC version. It's only
needed on DCN31 and only after link_enc is already assigned.

Fixes: 986430446c917b ("drm/amd/display: fix a crash on USB4 over C20 PHY")
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Nicholas Kazlauskas <nicholas.kazlauskas@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/dc/core/dc_link.c