[bug report] drm/amd/dc: Add dc display driver (v2)

Dan Carpenter dan.carpenter at oracle.com
Mon Nov 6 08:20:37 UTC 2017

Hello Harry Wentland,

The patch 4562236b3bc0: "drm/amd/dc: Add dc display driver (v2)" from
Sep 12, 2017, leads to the following static checker warning:

	drivers/gpu/drm/amd/amdgpu/../display/dc/dm_services.h:117 get_reg_field_value_ex()
	warn: mask and shift to zero

  1357  void dce110_link_encoder_enable_hpd(struct link_encoder *enc)
  1358  {
  1359          struct dce110_link_encoder *enc110 = TO_DCE110_LINK_ENC(enc);
  1360          struct dc_context *ctx = enc110->base.ctx;
  1361          uint32_t addr = HPD_REG(DC_HPD_CONTROL);
  1362          uint32_t hpd_enable = 0;
This is always just zero so the static checker complains:

  1363          uint32_t value = dm_read_reg(ctx, addr);
  1365          get_reg_field_value(hpd_enable, DC_HPD_CONTROL, DC_HPD_EN);
When we pass zero to here, we know that the answer is always going to
be zero.  But then we ignore the result from get_reg_field_value()
and I'm going to change Smatch so that that also generates a static
checker warning.  What's going on???

  1367          if (hpd_enable == 0)
This is true always.

  1368                  set_reg_field_value(value, 1, DC_HPD_CONTROL, DC_HPD_EN);
And we don't use the return for this either?  ARgh!!  This whole
function is a no-op?  My Brian is melting???

  1369  }

dan carpenter

More information about the amd-gfx mailing list