Skip to contentSkip to conversation

watchdog: machzwd: Mark expected switch fall-through

PATCH In review Gustavo A. R. Silva 2 participants 6 messages Apr 10, 2019 – Apr 24, 2019 Watchdog device drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 watchdog: machzwd: 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 warnings:

drivers/watchdog/machzwd.c: In function ‘zf_set_timer’:
./arch/x86/include/asm/io.h:355:14: warning: this statement may fall through [-Wimplicit-fallthrough=]
#define outw outw
drivers/watchdog/machzwd.c:80:53: note: in expansion of macro ‘outw’

 #define zf_writew(port, data)  { outb(port, INDEX); outw(data, DATA_W); }
                                                     ^~~~

drivers/watchdog/machzwd.c:179:3: note: in expansion of macro ‘zf_writew’
zf_writew(COUNTER_1, new);
^~~~~~~~~
drivers/watchdog/machzwd.c:180:2: note: here
case WD2:
^~~~

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

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

---
 drivers/watchdog/machzwd.c | 1 +
 1 file changed, 1 insertion(+)
drivers/watchdog/machzwd.c +1 -0
index 88d823d87a4b..108928dbc754 100644
@@ -177,6 +177,7 @@ static inline void zf_set_timer(unsigned short new, unsigned char n)
 	switch (n) {
 	case WD1:
 		zf_writew(COUNTER_1, new);
+		/* fall through */
 	case WD2:
 		zf_writeb(COUNTER_2, new > 0xff ? 0xff : new);
 	default:
Signature · 1 line
2.21.0
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 18 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 warnings:

drivers/watchdog/machzwd.c: In function ‘zf_set_timer’:
./arch/x86/include/asm/io.h:355:14: warning: this statement may fall through [-Wimplicit-fallthrough=]
#define outw outw
drivers/watchdog/machzwd.c:80:53: note: in expansion of macro ‘outw’

 #define zf_writew(port, data)  { outb(port, INDEX); outw(data, DATA_W); }
                                                     ^~~~
drivers/watchdog/machzwd.c:179:3: note: in expansion of macro ‘zf_writew’
   zf_writew(COUNTER_1, new);
   ^~~~~~~~~

drivers/watchdog/machzwd.c:180:2: note: here
case WD2:
^~~~

Quoted 6 lines

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

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

Quoted 19 lines
---
 drivers/watchdog/machzwd.c | 1 +
 1 file changed, 1 insertion(+)
drivers/watchdog/machzwd.c +1 -0
index 88d823d87a4b..108928dbc754 100644
@@ -177,6 +177,7 @@ static inline void zf_set_timer(unsigned short new, unsigned char n)
 	switch (n) {
 	case WD1:
 		zf_writew(COUNTER_1, new);
+		/* fall through */
 	case WD2:
 		zf_writeb(COUNTER_2, new > 0xff ? 0xff : new);
 	default:
Signature · 1 line
2.21.0
#2 lore raw
Quoted 19 lines · Guenter Roeck
Quoted 18 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 warnings:

drivers/watchdog/machzwd.c: In function ‘zf_set_timer’:
./arch/x86/include/asm/io.h:355:14: warning: this statement may fall through [-Wimplicit-fallthrough=]
#define outw outw
drivers/watchdog/machzwd.c:80:53: note: in expansion of macro ‘outw’

 #define zf_writew(port, data)  { outb(port, INDEX); outw(data, DATA_W); }
                                                     ^~~~
drivers/watchdog/machzwd.c:179:3: note: in expansion of macro ‘zf_writew’
   zf_writew(COUNTER_1, new);
   ^~~~~~~~~

drivers/watchdog/machzwd.c:180:2: note: here
case WD2:
^~~~

Quoted 9 lines
Quoted 6 lines

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

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

Thank you, Guenter.
--
Gustavo

Quoted 19 lines
Quoted 19 lines
---
 drivers/watchdog/machzwd.c | 1 +
 1 file changed, 1 insertion(+)
drivers/watchdog/machzwd.c +1 -0
index 88d823d87a4b..108928dbc754 100644
@@ -177,6 +177,7 @@ static inline void zf_set_timer(unsigned short new, unsigned char n)
 	switch (n) {
 	case WD1:
 		zf_writew(COUNTER_1, new);
+		/* fall through */
 	case WD2:
 		zf_writeb(COUNTER_2, new > 0xff ? 0xff : new);
 	default:
Signature · 1 line
2.21.0
#3 lore raw

Hi Guenter,

I wonder if you took this in you watchdog-next branch.

Thanks
--
Gustavo

Quoted 55 lines · Gustavo A. R. Silva
Quoted 19 lines · Guenter Roeck
Quoted 18 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 warnings:

drivers/watchdog/machzwd.c: In function ‘zf_set_timer’:
./arch/x86/include/asm/io.h:355:14: warning: this statement may fall through [-Wimplicit-fallthrough=]
#define outw outw
drivers/watchdog/machzwd.c:80:53: note: in expansion of macro ‘outw’

 #define zf_writew(port, data)  { outb(port, INDEX); outw(data, DATA_W); }
                                                     ^~~~
drivers/watchdog/machzwd.c:179:3: note: in expansion of macro ‘zf_writew’
   zf_writew(COUNTER_1, new);
   ^~~~~~~~~

drivers/watchdog/machzwd.c:180:2: note: here
case WD2:
^~~~

Quoted 9 lines
Quoted 6 lines

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

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

Thank you, Guenter.
--
Gustavo

Quoted 19 lines
Quoted 19 lines
---
 drivers/watchdog/machzwd.c | 1 +
 1 file changed, 1 insertion(+)
drivers/watchdog/machzwd.c +1 -0
index 88d823d87a4b..108928dbc754 100644
@@ -177,6 +177,7 @@ static inline void zf_set_timer(unsigned short new, unsigned char n)
 	switch (n) {
 	case WD1:
 		zf_writew(COUNTER_1, new);
+		/* fall through */
 	case WD2:
 		zf_writeb(COUNTER_2, new > 0xff ? 0xff : new);
 	default:
Signature · 1 line
2.21.0
maintainer
#4 lore raw
Quoted 4 lines · Gustavo A. R. Silva

Hi Guenter,

I wonder if you took this in you watchdog-next branch.

It is in branch watchdog-next of
git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging.git

waiting for Wim to pick it up.

Guenter

Quoted 60 lines

Thanks
--
Gustavo

Quoted 55 lines · Gustavo A. R. Silva
Quoted 19 lines · Guenter Roeck
Quoted 18 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 warnings:

drivers/watchdog/machzwd.c: In function ‘zf_set_timer’:
./arch/x86/include/asm/io.h:355:14: warning: this statement may fall through [-Wimplicit-fallthrough=]
#define outw outw
drivers/watchdog/machzwd.c:80:53: note: in expansion of macro ‘outw’

 #define zf_writew(port, data)  { outb(port, INDEX); outw(data, DATA_W); }
                                                     ^~~~
drivers/watchdog/machzwd.c:179:3: note: in expansion of macro ‘zf_writew’
   zf_writew(COUNTER_1, new);
   ^~~~~~~~~

drivers/watchdog/machzwd.c:180:2: note: here
case WD2:
^~~~

Quoted 9 lines
Quoted 6 lines

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

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

Thank you, Guenter.
--
Gustavo

Quoted 19 lines
Quoted 19 lines
---
 drivers/watchdog/machzwd.c | 1 +
 1 file changed, 1 insertion(+)
drivers/watchdog/machzwd.c +1 -0
index 88d823d87a4b..108928dbc754 100644
@@ -177,6 +177,7 @@ static inline void zf_set_timer(unsigned short new, unsigned char n)
 	switch (n) {
 	case WD1:
 		zf_writew(COUNTER_1, new);
+		/* fall through */
 	case WD2:
 		zf_writeb(COUNTER_2, new > 0xff ? 0xff : new);
 	default:
Signature · 1 line
2.21.0
#5 lore raw
Quoted 11 lines · Guenter Roeck
Quoted 4 lines · Gustavo A. R. Silva

Hi Guenter,

I wonder if you took this in you watchdog-next branch.

It is in branch watchdog-next of
git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging.git

waiting for Wim to pick it up.

Awesome.

Thank you!
--
Gustavo