drm/amd/display: Add link enc null ptr check for cable ID (#2597)
authorShen, George <George.Shen@amd.com>
Fri, 28 Jan 2022 14:03:55 +0000 (22:03 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 2 Feb 2022 23:26:31 +0000 (18:26 -0500)
[Why]
Certain configurations will result in link encoder
to not be assigned to the link at the time we apply
cable ID logic. We should skip it in those cases.

[How]
Check if link_enc is not null before applying
cable ID.

Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Reviewed-by: Wenjing Liu <Wenjing.Liu@amd.com>
Acked-by: Stylon Wang <stylon.wang@amd.com>
Signed-off-by: George Shen <george.shen@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c

index 8cfc9a8..117183b 100644 (file)
@@ -6327,7 +6327,12 @@ void dpcd_set_source_specific_data(struct dc_link *link)
 
 void dpcd_update_cable_id(struct dc_link *link)
 {
-       if (!link->link_enc->features.flags.bits.IS_UHBR10_CAPABLE ||
+       struct link_encoder *link_enc = NULL;
+
+       link_enc = link_enc_cfg_get_link_enc(link);
+
+       if (!link_enc ||
+                       !link_enc->features.flags.bits.IS_UHBR10_CAPABLE ||
                        link->dprx_status.cable_id_updated)
                return;