[bug report] drm/amd/display: Add connector HPD trigger debugfs entry

Dan Carpenter dan.carpenter at linaro.org
Fri May 19 06:52:42 UTC 2023


Hello Eryk Brol,

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

The patch 6f77b2ac6280: "drm/amd/display: Add connector HPD trigger
debugfs entry" from Aug 10, 2020, leads to the following Smatch
complaint:

    drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm_debugfs.c:1220 trigger_hotplug()
    warn: variable dereferenced before check 'aconnector' (see line 1210)

drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm_debugfs.c
  1204  static ssize_t trigger_hotplug(struct file *f, const char __user *buf,
  1205                                                          size_t size, loff_t *pos)
  1206  {
  1207          struct amdgpu_dm_connector *aconnector = file_inode(f)->i_private;
  1208          struct drm_connector *connector = &aconnector->base;
                                                   ^^^^^^^^^^^^^^^^
Not a dereference.

  1209          struct dc_link *link = NULL;
  1210          struct drm_device *dev = connector->dev;
                                         ^^^^^^^^^^^^^^
Argh... dereference.

  1211          struct amdgpu_device *adev = drm_to_adev(dev);
  1212          enum dc_connection_type new_connection_type = dc_connection_none;
  1213          char *wr_buf = NULL;
  1214          uint32_t wr_buf_size = 42;
  1215          int max_param_num = 1;
  1216          long param[1] = {0};
  1217          uint8_t param_nums = 0;
  1218          bool ret = false;
  1219  
  1220          if (!aconnector || !aconnector->dc_link)
                    ^^^^^^^^^^^
Too late.  Dead already.

  1221                  return -EINVAL;
  1222  
  1223          if (size == 0)

regards,
dan carpenter


More information about the amd-gfx mailing list