[bug report] drm/amd/display: Add connector to the state if DSC debugfs is set

Dan Carpenter dan.carpenter at oracle.com
Fri Sep 18 14:28:41 UTC 2020


Hello Eryk Brol,

The patch c44a22b3128d: "drm/amd/display: Add connector to the state
if DSC debugfs is set" from Aug 27, 2020, leads to the following
static checker warning:

	drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:917 amdgpu_check_debugfs_connector_property_change()
	error: 'crtc_state' dereferencing possible ERR_PTR()

drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c
   883  static void amdgpu_check_debugfs_connector_property_change(struct amdgpu_device *adev,
   884                                                             struct drm_atomic_state *state)
   885  {
   886          struct drm_connector *connector;
   887          struct drm_crtc *crtc;
   888          struct amdgpu_dm_connector *amdgpu_dm_connector;
   889          struct drm_connector_state *conn_state;
   890          struct dm_crtc_state *acrtc_state;
   891          struct drm_crtc_state *crtc_state;
   892          struct dc_stream_state *stream;
   893          struct drm_device *dev = adev_to_drm(adev);
   894  
   895          list_for_each_entry(connector, &dev->mode_config.connector_list, head) {
   896  
   897                  amdgpu_dm_connector = to_amdgpu_dm_connector(connector);
   898                  conn_state = connector->state;
   899  
   900                  if (!(conn_state && conn_state->crtc))
   901                          continue;
   902  
   903                  crtc = conn_state->crtc;
   904                  acrtc_state = to_dm_crtc_state(crtc->state);
   905  
   906                  if (!(acrtc_state && acrtc_state->stream))
   907                          continue;
   908  
   909                  stream = acrtc_state->stream;
   910  
   911                  if (amdgpu_dm_connector->dsc_settings.dsc_force_enable ||
   912                      amdgpu_dm_connector->dsc_settings.dsc_num_slices_v ||
   913                      amdgpu_dm_connector->dsc_settings.dsc_num_slices_h ||
   914                      amdgpu_dm_connector->dsc_settings.dsc_bits_per_pixel) {
   915                          conn_state = drm_atomic_get_connector_state(state, connector);
   916                          crtc_state = drm_atomic_get_crtc_state(state, crtc);
                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Check for errors?

   917                          crtc_state->mode_changed = true;
   918                  }
   919          }
   920  }

regards,
dan carpenter


More information about the amd-gfx mailing list