[bug report] drm/amdgpu/virt: use kiq to access registers (v2)

Dan Carpenter dan.carpenter at oracle.com
Tue Feb 7 08:31:27 UTC 2017


Hello Xiangliang Yu,

The patch bc992ba5a3c1: "drm/amdgpu/virt: use kiq to access registers
(v2)" from Jan 12, 2017, leads to the following static checker
warning:

	drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c:122 amdgpu_virt_kiq_rreg()
	error: uninitialized symbol 'f'.

drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
   104  uint32_t amdgpu_virt_kiq_rreg(struct amdgpu_device *adev, uint32_t reg)
   105  {
   106          signed long r;
   107          uint32_t val;
   108          struct dma_fence *f;
   109          struct amdgpu_kiq *kiq = &adev->gfx.kiq;
   110          struct amdgpu_ring *ring = &kiq->ring;
   111  
   112          BUG_ON(!ring->funcs->emit_rreg);
   113  
   114          mutex_lock(&adev->virt.lock);
   115          amdgpu_ring_alloc(ring, 32);
   116          amdgpu_ring_emit_hdp_flush(ring);
   117          amdgpu_ring_emit_rreg(ring, reg);
   118          amdgpu_ring_emit_hdp_invalidate(ring);
   119          amdgpu_fence_emit(ring, &f);

What about if amdgpu_fence_emit() returns -ENOMEM?

   120          amdgpu_ring_commit(ring);
   121          mutex_unlock(&adev->virt.lock);
   122  
   123          r = dma_fence_wait(f, false);
   124          if (r)
   125                  DRM_ERROR("wait for kiq fence error: %ld.\n", r);
   126          dma_fence_put(f);
   127  
   128          val = adev->wb.wb[adev->virt.reg_val_offs];
   129  
   130          return val;
   131  }

regards,
dan carpenter


More information about the amd-gfx mailing list