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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

drivers/gpu/drm/amd/display/dc/dce/dce_link_encoder.c
  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);
  1364  
  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???

  1366  
  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  }

regards,
dan carpenter


[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux