Skip to contentSkip to conversation

drm/amd/display: access hpo dp link encoder only through link resource

bug report Dan Carpenter 1 participant 1 message Jan 31, 2022

lore
Share & tools
lore
#0 lore raw

Hello Wenjing Liu,

The patch 3d38a5839ea8: "drm/amd/display: access hpo dp link encoder only through link resource" from Nov 26, 2021, leads to the following Smatch static checker warning:

	drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc_link_dp.c:2961 dc_link_dp_sync_lt_end()
	error: NULL dereference inside function dp_disable_link_phy()

drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc_link_dp.c

    2954 bool dc_link_dp_sync_lt_end(struct dc_link *link, bool link_down)
    2955 {
    2956         /* If input parameter is set, shut down phy.
    2957          * Still shouldn't turn off dp_receiver (DPCD:600h)
    2958          */
    2959         if (link_down == true) {
    2960                 struct dc_link_settings link_settings = link->cur_link_settings;
--> 2961                 dp_disable_link_phy(link, NULL, link->connector_signal);
                                                   ^^^^

This NULL will lead to an Oops.

    2962                 if (dp_get_link_encoding_format(&link_settings) == DP_8b_10b_ENCODING)
    2963                         dp_set_fec_ready(link, NULL, false);
    2964         }
    2965 
    2966         link->sync_lt_in_progress = false;
    2967         return true;
    2968 }

regards,
dan carpenter