Skip to contentSkip to conversation

Input: mark expected switch fall-through

PATCH Applied Gustavo A. R. Silva 2 participants 3 messages Feb 11, 2019

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

PATCH 1/1 Input: mark expected switch fall-through

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

This patch fixes the following warning:

drivers/input/joystick/db9.c: In function ‘db9_saturn_read_packet’:
drivers/input/joystick/db9.c:256:6: warning: this statement may fall through [-Wimplicit-fallthrough=]

   if (tmp == 0xff) {
      ^

drivers/input/joystick/db9.c:263:2: note: here
default:
^~~~~~~

Notice that, in this particular case, the code comment is modified in accordance with what GCC is expecting to find.

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

---
 drivers/input/joystick/db9.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/input/joystick/db9.c +1 -1
index 804b1b80a8be..5a52b65bef9a 100644
@@ -259,7 +259,7 @@ static unsigned char db9_saturn_read_packet(struct parport *port, unsigned char
 			db9_saturn_write_sub(port, type, 3, powered, 0);
 			return data[0] = 0xe3;
 		}
-		/* else: fall through */
+		/* fall through */
 	default:
 		return data[0];
 	}
Signature · 1 line
2.20.1
maintainer Applied
#1 lore raw
Quoted 13 lines · Gustavo A. R. Silva

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

This patch fixes the following warning:

drivers/input/joystick/db9.c: In function ‘db9_saturn_read_packet’:
drivers/input/joystick/db9.c:256:6: warning: this statement may fall through [-Wimplicit-fallthrough=]

   if (tmp == 0xff) {
      ^

drivers/input/joystick/db9.c:263:2: note: here
default:
^~~~~~~

Quoted 7 lines

Notice that, in this particular case, the code comment is modified in accordance with what GCC is expecting to find.

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

Applied, thank you.

Quoted 20 lines
---
 drivers/input/joystick/db9.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/input/joystick/db9.c +1 -1
index 804b1b80a8be..5a52b65bef9a 100644
@@ -259,7 +259,7 @@ static unsigned char db9_saturn_read_packet(struct parport *port, unsigned char
 			db9_saturn_write_sub(port, type, 3, powered, 0);
 			return data[0] = 0xe3;
 		}
-		/* else: fall through */
+		/* fall through */
 	default:
 		return data[0];
 	}
Signature · 1 line
2.20.1
Signature · 1 line
Dmitry
#2 lore raw
Quoted 17 lines · Dmitry Torokhov
Quoted 16 lines · Gustavo A. R. Silva

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

This patch fixes the following warning:

drivers/input/joystick/db9.c: In function ‘db9_saturn_read_packet’:
drivers/input/joystick/db9.c:256:6: warning: this statement may fall through [-Wimplicit-fallthrough=]

   if (tmp == 0xff) {
      ^

drivers/input/joystick/db9.c:263:2: note: here
default:
^~~~~~~

Notice that, in this particular case, the code comment is modified in accordance with what GCC is expecting to find.

Quoted 7 lines
Quoted 4 lines

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

Applied, thank you.

Thanks, Dmitry.

--
Gustavo