Skip to contentSkip to conversation

adfs: mark expected switch fall-throughs

PATCH In review Gustavo A. R. Silva 3 participants 3 messages Jan 14, 2019 – Apr 9, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 adfs: mark expected switch fall-throughs

In preparation to enabling -Wimplicit-fallthrough, mark switch cases where we are expecting to fall through.

Warning level 3 was used: -Wimplicit-fallthrough=3

This patch is part of the ongoing efforts to enabling -Wimplicit-fallthrough

---
 fs/adfs/dir_f.c | 6 ++++++
 1 file changed, 6 insertions(+)
fs/adfs/dir_f.c +6 -0
index 0fbfd0b04ae0..382c9d7ad375 100644
@@ -24,8 +24,11 @@ static inline unsigned int adfs_readval(unsigned char *p, int len)
 
 	switch (len) {
 	case 4:		val |= p[3] << 24;
+			/* fall through */
 	case 3:		val |= p[2] << 16;
+			/* fall through */
 	case 2:		val |= p[1] << 8;
+			/* fall through */
 	default:	val |= p[0];
 	}
 	return val;
@@ -35,8 +38,11 @@ static inline void adfs_writeval(unsigned char *p, int len, unsigned int val)
 {
 	switch (len) {
 	case 4:		p[3] = val >> 24;
+			/* fall through */
 	case 3:		p[2] = val >> 16;
+			/* fall through */
 	case 2:		p[1] = val >> 8;
+			/* fall through */
 	default:	p[0] = val;
 	}
 }
Signature · 1 line
2.20.1
#1 lore raw

Hi Gustavo,

Quoted 6 lines · On Mon, 14 Jan 2019 14:35:07 -0600 "Gustavo A. R. Silva"…

In preparation to enabling -Wimplicit-fallthrough, mark switch cases where we are expecting to fall through.

Warning level 3 was used: -Wimplicit-fallthrough=3

Quoted 7 lines

This patch is part of the ongoing efforts to enabling -Wimplicit-fallthrough

---
 fs/adfs/dir_f.c | 6 ++++++
 1 file changed, 6 insertions(+)

Added to my fixes tree.

Signature · 2 lines
Cheers,
Stephen Rothwell
Reviewed-by on v1 1/1
#2 lore raw
In reply to Gustavo A. R. Silva
Quoted 10 lines · Gustavo A. R. Silva

In preparation to enabling -Wimplicit-fallthrough, mark switch cases where we are expecting to fall through.

Warning level 3 was used: -Wimplicit-fallthrough=3

This patch is part of the ongoing efforts to enabling -Wimplicit-fallthrough

Please consider this reviewed! :)

Signature · 1 line
Kees Cook