[bug report] drm/amd/display: Link train only when link is DP and backend is enabled

Dan Carpenter dan.carpenter at oracle.com
Mon Mar 25 08:14:17 UTC 2019


Hello Samson Tam,

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

The patch 66acd4418d7d: "drm/amd/display: Link train only when link
is DP and backend is enabled" from Mar 4, 2019, leads to the
following Smatch complaint:

    drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc.c:553 dc_link_set_preferred_link_settings()
    warn: variable dereferenced before check 'link_stream' (see line 550)

drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc.c
   540                  }
   541          }
   542  
   543          /* Stream not found */
   544          if (i == MAX_PIPES)
   545                  return;
   546  
   547          link_stream = link->dc->current_state->res_ctx.pipe_ctx[i].stream;
   548  
   549		/* Cannot retrain link if backend is off */
   550		if (link_stream->dpms_off)
                    ^^^^^^^^^^^^^^^^^^^^^
New check

   551			return;
   552	
   553		if (link_stream)
                    ^^^^^^^^^^^
The old code used to check for NULL
   554			decide_link_settings(link_stream, &store_settings);
   555	

regards,
dan carpenter


More information about the amd-gfx mailing list