[bug report] drm/amd/display: Fix exception from AUX acquire failure

Dan Carpenter dan.carpenter at oracle.com
Wed Oct 2 11:58:14 UTC 2019


Hello Anthony Koo,

The patch dcf1a988678e: "drm/amd/display: Fix exception from AUX
acquire failure" from Feb 6, 2019, leads to the following static
checker warning:

	drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm_mst_types.c:108 dm_dp_aux_transfer()
	error: uninitialized symbol 'operation_result'.

drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm_mst_types.c
    82  static ssize_t dm_dp_aux_transfer(struct drm_dp_aux *aux,
    83                                    struct drm_dp_aux_msg *msg)
    84  {
    85          ssize_t result = 0;
    86          struct aux_payload payload;
    87          enum aux_channel_operation_result operation_result;
    88  
    89          if (WARN_ON(msg->size > 16))
    90                  return -E2BIG;
    91  
    92          payload.address = msg->address;
    93          payload.data = msg->buffer;
    94          payload.length = msg->size;
    95          payload.reply = &msg->reply;
    96          payload.i2c_over_aux = (msg->request & DP_AUX_NATIVE_WRITE) == 0;
    97          payload.write = (msg->request & DP_AUX_I2C_READ) == 0;
    98          payload.mot = (msg->request & DP_AUX_I2C_MOT) != 0;
    99          payload.defer_delay = 0;
   100  
   101          result = dc_link_aux_transfer_raw(TO_DM_AUX(aux)->ddc_service, &payload,
   102                                        &operation_result);
                                              ^^^^^^^^^^^^^^^^^
The patch adds a new return where "operation_result" isn't initialized.

   103  
   104          if (payload.write)
   105                  result = msg->size;
   106  
   107          if (result < 0)
   108                  switch (operation_result) {
                                ^^^^^^^^^^^^^^^^

   109                  case AUX_CHANNEL_OPERATION_SUCCEEDED:
   110                          break;
   111                  case AUX_CHANNEL_OPERATION_FAILED_HPD_DISCON:
   112                  case AUX_CHANNEL_OPERATION_FAILED_REASON_UNKNOWN:
   113                          result = -EIO;
   114                          break;
   115                  case AUX_CHANNEL_OPERATION_FAILED_INVALID_REPLY:
   116                          result = -EBUSY;
   117                          break;
   118                  case AUX_CHANNEL_OPERATION_FAILED_TIMEOUT:
   119                          result = -ETIMEDOUT;
   120                          break;
   121                  }
   122  
   123          return result;
   124  }

regards,
dan carpenter


More information about the amd-gfx mailing list