Skip to contentSkip to conversation

drm/dp: annotate implicit fall throughs

PATCH In review Mathieu Malaterre 3 participants 3 messages Jan 14, 2019 – Jan 15, 2019

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

PATCH 1/1 drm/dp: annotate implicit fall throughs

There is a plan to build the kernel with -Wimplicit-fallthrough and these places in the code produced warnings (W=1). Fix them up.

This commit remove the following warnings:

include/linux/compiler.h:77:22: warning: this statement may fall through [-Wimplicit-fallthrough=] include/asm-generic/bug.h:134:2: note: in expansion of macro 'unlikely' drivers/gpu/drm/drm_dp_helper.c:155:3: note: in expansion of macro 'WARN' include/linux/compiler.h:77:22: warning: this statement may fall through [-Wimplicit-fallthrough=] include/asm-generic/bug.h:134:2: note: in expansion of macro 'unlikely' drivers/gpu/drm/drm_dp_helper.c:173:3: note: in expansion of macro 'WARN' drivers/gpu/drm/drm_dp_helper.c:547:3: warning: this statement may fall through [-Wimplicit-fallthrough=]

---
 drivers/gpu/drm/drm_dp_helper.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/gpu/drm/drm_dp_helper.c +3 -0
index 516e82d0ed50..26835d174939 100644
@@ -154,6 +154,7 @@ u8 drm_dp_link_rate_to_bw_code(int link_rate)
 	default:
 		WARN(1, "unknown DP link rate %d, using %x\n", link_rate,
 		     DP_LINK_BW_1_62);
+		/* fall through */
 	case 162000:
 		return DP_LINK_BW_1_62;
 	case 270000:
@@ -171,6 +172,7 @@ int drm_dp_bw_code_to_link_rate(u8 link_bw)
 	switch (link_bw) {
 	default:
 		WARN(1, "unknown DP link BW code %x, using 162000\n", link_bw);
+		/* fall through */
 	case DP_LINK_BW_1_62:
 		return 162000;
 	case DP_LINK_BW_2_7:
@@ -552,6 +554,7 @@ int drm_dp_downstream_max_bpc(const u8 dpcd[DP_RECEIVER_CAP_SIZE],
 		case DP_DS_16BPC:
 			return 16;
 		}
+		/* fall through */
 	default:
 		return 0;
 	}
Signature · 1 line
2.19.2
Acked-by on v1 1/1
#1 lore raw
Quoted 13 lines · Mathieu Malaterre

There is a plan to build the kernel with -Wimplicit-fallthrough and these places in the code produced warnings (W=1). Fix them up.

This commit remove the following warnings:

include/linux/compiler.h:77:22: warning: this statement may fall through [-Wimplicit-fallthrough=] include/asm-generic/bug.h:134:2: note: in expansion of macro 'unlikely' drivers/gpu/drm/drm_dp_helper.c:155:3: note: in expansion of macro 'WARN' include/linux/compiler.h:77:22: warning: this statement may fall through [-Wimplicit-fallthrough=] include/asm-generic/bug.h:134:2: note: in expansion of macro 'unlikely' drivers/gpu/drm/drm_dp_helper.c:173:3: note: in expansion of macro 'WARN' drivers/gpu/drm/drm_dp_helper.c:547:3: warning: this statement may fall through [-Wimplicit-fallthrough=]

Quoted 1 line
Quoted 33 lines
---
  drivers/gpu/drm/drm_dp_helper.c | 3 +++
  1 file changed, 3 insertions(+)
drivers/gpu/drm/drm_dp_helper.c +3 -0
index 516e82d0ed50..26835d174939 100644
@@ -154,6 +154,7 @@ u8 drm_dp_link_rate_to_bw_code(int link_rate)
  	default:
  		WARN(1, "unknown DP link rate %d, using %x\n", link_rate,
  		     DP_LINK_BW_1_62);
+		/* fall through */
  	case 162000:
  		return DP_LINK_BW_1_62;
  	case 270000:
@@ -171,6 +172,7 @@ int drm_dp_bw_code_to_link_rate(u8 link_bw)
  	switch (link_bw) {
  	default:
  		WARN(1, "unknown DP link BW code %x, using 162000\n", link_bw);
+		/* fall through */
  	case DP_LINK_BW_1_62:
  		return 162000;
  	case DP_LINK_BW_2_7:
@@ -552,6 +554,7 @@ int drm_dp_downstream_max_bpc(const u8 dpcd[DP_RECEIVER_CAP_SIZE],
  		case DP_DS_16BPC:
  			return 16;
  		}
+		/* fall through */
  	default:
  		return 0;
  	}
#2 lore raw
Quoted 16 lines · Gustavo A. R. Silva
Quoted 13 lines · Mathieu Malaterre

There is a plan to build the kernel with -Wimplicit-fallthrough and these places in the code produced warnings (W=1). Fix them up.

This commit remove the following warnings:

include/linux/compiler.h:77:22: warning: this statement may fall through [-Wimplicit-fallthrough=] include/asm-generic/bug.h:134:2: note: in expansion of macro 'unlikely' drivers/gpu/drm/drm_dp_helper.c:155:3: note: in expansion of macro 'WARN' include/linux/compiler.h:77:22: warning: this statement may fall through [-Wimplicit-fallthrough=] include/asm-generic/bug.h:134:2: note: in expansion of macro 'unlikely' drivers/gpu/drm/drm_dp_helper.c:173:3: note: in expansion of macro 'WARN' drivers/gpu/drm/drm_dp_helper.c:547:3: warning: this statement may fall through [-Wimplicit-fallthrough=]

Quoted 2 lines
Quoted 1 line

Thanks for your patch, applied.
-Daniel

Quoted 34 lines
Quoted 34 lines
---
  drivers/gpu/drm/drm_dp_helper.c | 3 +++
  1 file changed, 3 insertions(+)
drivers/gpu/drm/drm_dp_helper.c +3 -0
index 516e82d0ed50..26835d174939 100644
@@ -154,6 +154,7 @@ u8 drm_dp_link_rate_to_bw_code(int link_rate)
  	default:
  		WARN(1, "unknown DP link rate %d, using %x\n", link_rate,
  		     DP_LINK_BW_1_62);
+		/* fall through */
  	case 162000:
  		return DP_LINK_BW_1_62;
  	case 270000:
@@ -171,6 +172,7 @@ int drm_dp_bw_code_to_link_rate(u8 link_bw)
  	switch (link_bw) {
  	default:
  		WARN(1, "unknown DP link BW code %x, using 162000\n", link_bw);
+		/* fall through */
  	case DP_LINK_BW_1_62:
  		return 162000;
  	case DP_LINK_BW_2_7:
@@ -552,6 +554,7 @@ int drm_dp_downstream_max_bpc(const u8 dpcd[DP_RECEIVER_CAP_SIZE],
  		case DP_DS_16BPC:
  			return 16;
  		}
+		/* fall through */
  	default:
  		return 0;
  	}
Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel