Commit d3abc78f authored by Dan Carpenter's avatar Dan Carpenter Committed by Alex Deucher

drm/amd/display: Fix a potential NULL dereference

The debug printk dereferences "link->link_enc" before we have ensured
that it is non-NULL.  Fix this potential NULL derefence by moving the
printk after the check.

Fixes: 64ff0882 ("drm/amd/display: Log link/connector info provided in BIOS object table")
Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 23a63e91
...@@ -1525,13 +1525,13 @@ static bool dc_link_construct(struct dc_link *link, ...@@ -1525,13 +1525,13 @@ static bool dc_link_construct(struct dc_link *link,
link->link_enc = link->link_enc =
link->dc->res_pool->funcs->link_enc_create(&enc_init_data); link->dc->res_pool->funcs->link_enc_create(&enc_init_data);
DC_LOG_DC("BIOS object table - DP_IS_USB_C: %d", link->link_enc->features.flags.bits.DP_IS_USB_C);
if (!link->link_enc) { if (!link->link_enc) {
DC_ERROR("Failed to create link encoder!\n"); DC_ERROR("Failed to create link encoder!\n");
goto link_enc_create_fail; goto link_enc_create_fail;
} }
DC_LOG_DC("BIOS object table - DP_IS_USB_C: %d", link->link_enc->features.flags.bits.DP_IS_USB_C);
link->link_enc_hw_inst = link->link_enc->transmitter; link->link_enc_hw_inst = link->link_enc->transmitter;
for (i = 0; i < 4; i++) { for (i = 0; i < 4; i++) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment