Skip to contentSkip to conversation

drm: msm: a6xx: Mark expected switch fall-through

PATCH In review Anders Roxell 2 participants 2 messages Jul 26, 2019 – Aug 1, 2019

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/3 drm: msm: a6xx: Mark expected switch fall-through

When fall-through warnings was enabled by default the following warning was starting to show up:

../drivers/gpu/drm/msm/adreno/a6xx_gpu.c: In function ‘a6xx_submit’:
../drivers/gpu/drm/msm/adreno/a6xx_gpu.c:116:7: warning: this statement may fall
through [-Wimplicit-fallthrough=]

    if (priv->lastctx == ctx)
       ^

../drivers/gpu/drm/msm/adreno/a6xx_gpu.c:118:3: note: here
case MSM_SUBMIT_CMD_BUF:
^~~~

Rework so that the compiler doesn't warn about fall-through.

Fixes d93512ef0f0e ("Makefile: Globally enable fall-through warning")
---
 drivers/gpu/drm/msm/adreno/a6xx_gpu.c | 1 +
 1 file changed, 1 insertion(+)
drivers/gpu/drm/msm/adreno/a6xx_gpu.c +1 -0
index be39cf01e51e..644a6ee53f05 100644
@@ -115,6 +115,7 @@ static void a6xx_submit(struct msm_gpu *gpu, struct msm_gem_submit *submit,
 		case MSM_SUBMIT_CMD_CTX_RESTORE_BUF:
 			if (priv->lastctx == ctx)
 				break;
+			/* Fall through */
 		case MSM_SUBMIT_CMD_BUF:
 			OUT_PKT7(ring, CP_INDIRECT_BUFFER_PFE, 3);
 			OUT_RING(ring, lower_32_bits(submit->cmd[i].iova));
Signature · 1 line
2.20.1
reviewer
#1 lore raw
Quoted 12 lines · Anders Roxell

When fall-through warnings was enabled by default the following warning was starting to show up:

../drivers/gpu/drm/msm/adreno/a6xx_gpu.c: In function ‘a6xx_submit’:
../drivers/gpu/drm/msm/adreno/a6xx_gpu.c:116:7: warning: this statement may fall
through [-Wimplicit-fallthrough=]

    if (priv->lastctx == ctx)
       ^
../drivers/gpu/drm/msm/adreno/a6xx_gpu.c:118:3: note: here
   case MSM_SUBMIT_CMD_BUF:
   ^~~~
Quoted 4 lines

Rework so that the compiler doesn't warn about fall-through.

Fixes d93512ef0f0e ("Makefile: Globally enable fall-through warning")

Hi Anders,
Thank you for your patches. Jordan had previously sent the same fixes in "drm/msm: Annotate intentional switch statement fall throughs" one day earlier than yours, so I'll pick up that patch.

Thanks again!

Sean

Quoted 19 lines
---
 drivers/gpu/drm/msm/adreno/a6xx_gpu.c | 1 +
 1 file changed, 1 insertion(+)
drivers/gpu/drm/msm/adreno/a6xx_gpu.c +1 -0
index be39cf01e51e..644a6ee53f05 100644
@@ -115,6 +115,7 @@ static void a6xx_submit(struct msm_gpu *gpu, struct msm_gem_submit *submit,
 		case MSM_SUBMIT_CMD_CTX_RESTORE_BUF:
 			if (priv->lastctx == ctx)
 				break;
+			/* Fall through */
 		case MSM_SUBMIT_CMD_BUF:
 			OUT_PKT7(ring, CP_INDIRECT_BUFFER_PFE, 3);
 			OUT_RING(ring, lower_32_bits(submit->cmd[i].iova));
Signature · 1 line
2.20.1
Signature · 1 line
Sean Paul, Software Engineer, Google / Chromium OS