[bug report] drm/amd/display: break down dc_link.c

Dan Carpenter error27 at gmail.com
Thu Feb 16 16:19:04 UTC 2023


Hello Wenjing Liu,

This is a semi-automatic email about new static checker warnings.

The patch 54618888d1ea: "drm/amd/display: break down dc_link.c" from 
Jan 18, 2023, leads to the following Smatch complaint:

    drivers/gpu/drm/amd/amdgpu/../display/dc/link/link_factory.c:365 dc_link_construct_phy()
    warn: variable dereferenced before check 'link->link_enc' (see line 362)

drivers/gpu/drm/amd/amdgpu/../display/dc/link/link_factory.c
   356  
   357          enc_init_data.transmitter =
   358                  translate_encoder_to_transmitter(enc_init_data.encoder);
   359          link->link_enc =
   360                  link->dc->res_pool->funcs->link_enc_create(dc_ctx, &enc_init_data);
   361  
   362          DC_LOG_DC("BIOS object table - DP_IS_USB_C: %d", link->link_enc->features.flags.bits.DP_IS_USB_C);
                                                                 ^^^^^^^^^^^^^^^^
Dereference

   363          DC_LOG_DC("BIOS object table - IS_DP2_CAPABLE: %d", link->link_enc->features.flags.bits.IS_DP2_CAPABLE);
                                                                    ^^^^^^^^^^^^^^^^

   364  
   365          if (!link->link_enc) {
                     ^^^^^^^^^^^^^^
Checked too late

   366                  DC_ERROR("Failed to create link encoder!\n");
   367                  goto link_enc_create_fail;
   368          }
   369  

regards,
dan carpenter


More information about the amd-gfx mailing list