dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [bug report] drm/amdgpu: refine uvd4.2 init/stop code.
@ 2017-02-13 18:58 Dan Carpenter
  0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2017-02-13 18:58 UTC (permalink / raw)
  To: Rex.Zhu-5C7GfCeVMHo
  Cc: dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

Hello Rex Zhu,

The patch 8b55d17eeea7: "drm/amdgpu: refine uvd4.2 init/stop code."
from Jan 20, 2017, leads to the following static checker warning:

	drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c:397 uvd_v4_2_stop()
	info: ignoring unreachable code.

	drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c:407 uvd_v4_2_stop()
	info: ignoring unreachable code.

	drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c:420 uvd_v4_2_stop()
	info: ignoring unreachable code.


drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c
   390  static void uvd_v4_2_stop(struct amdgpu_device *adev)
   391  {
   392          uint32_t i, j;
   393          uint32_t status;
   394  
   395          WREG32(mmUVD_RBC_RB_CNTL, 0x11010101);
   396  
   397          for (i = 0; i < 10; ++i) {
   398                  for (j = 0; j < 100; ++j) {
   399                          status = RREG32(mmUVD_STATUS);
   400                          if (status & 2)
   401                                  break;
   402                          mdelay(1);
   403                  }
   404                  break;

This i < 10 loops don't make sense because we break after the first
iteration...  What is intended?

   405          }
   406  
   407          for (i = 0; i < 10; ++i) {
   408                  for (j = 0; j < 100; ++j) {
   409                          status = RREG32(mmUVD_LMI_STATUS);
   410                          if (status & 0xf)
   411                                  break;
   412                          mdelay(1);
   413                  }
   414                  break;
                        ^^^^^^
   415          }
   416  
   417          /* Stall UMC and register bus before resetting VCPU */
   418          WREG32_P(mmUVD_LMI_CTRL2, 1 << 8, ~(1 << 8));
   419  
   420          for (i = 0; i < 10; ++i) {
   421                  for (j = 0; j < 100; ++j) {
   422                          status = RREG32(mmUVD_LMI_STATUS);
   423                          if (status & 0x240)
   424                                  break;
   425                          mdelay(1);
   426                  }
   427                  break;
                        ^^^^^^
   428          }
   429  

regards,
dan carpenter
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2017-02-13 18:58 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-02-13 18:58 [bug report] drm/amdgpu: refine uvd4.2 init/stop code Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox