linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [v2] USB: serial: io_edgeport: mark expected switch fall-throughs
@ 2019-05-01 21:33 Gustavo A. R. Silva
  2019-05-01 21:33 ` [PATCH v2] " Gustavo A. R. Silva
  2019-05-02 10:26 ` [v2] " Johan Hovold
  0 siblings, 2 replies; 22+ messages in thread
From: Gustavo A. R. Silva @ 2019-05-01 21:33 UTC (permalink / raw)
  To: Johan Hovold, Greg Kroah-Hartman
  Cc: linux-usb, linux-kernel, Gustavo A. R. Silva, Kees Cook

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

This patch fixes the following warnings:

drivers/usb/serial/io_edgeport.c: In function ‘process_rcvd_data’:
drivers/usb/serial/io_edgeport.c:1750:7: warning: this statement may fall through [-Wimplicit-fallthrough=]
    if (bufferLength == 0) {
       ^
drivers/usb/serial/io_edgeport.c:1755:3: note: here
   case EXPECT_HDR2:
   ^~~~
drivers/usb/serial/io_edgeport.c:1810:8: warning: this statement may fall through [-Wimplicit-fallthrough=]
     if (bufferLength == 0) {
        ^
drivers/usb/serial/io_edgeport.c:1816:3: note: here
   case EXPECT_DATA: /* Expect data */
   ^~~~

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

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

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

Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
---
Changes in v2:
 - Warning level 3 is now used: -Wimplicit-fallthrough=3
   instead of warning level 2.
 - All warnings in the switch statement are addressed now.

Notice that these are the last remaining fall-through warnings
in the USB subsystem. :)

Thanks
--
Gustavo

 drivers/usb/serial/io_edgeport.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/serial/io_edgeport.c b/drivers/usb/serial/io_edgeport.c
index 4ca31c0e4174..7ad10328f4e2 100644
--- a/drivers/usb/serial/io_edgeport.c
+++ b/drivers/usb/serial/io_edgeport.c
@@ -1751,7 +1751,7 @@ static void process_rcvd_data(struct edgeport_serial *edge_serial,
 				edge_serial->rxState = EXPECT_HDR2;
 				break;
 			}
-			/* otherwise, drop on through */
+			/* Fall through - otherwise, drop on through */
 		case EXPECT_HDR2:
 			edge_serial->rxHeader2 = *buffer;
 			++buffer;
@@ -1813,6 +1813,7 @@ static void process_rcvd_data(struct edgeport_serial *edge_serial,
 				}
 				/* Else, drop through */
 			}
+			/* Fall through */
 		case EXPECT_DATA: /* Expect data */
 			if (bufferLength < edge_serial->rxBytesRemaining) {
 				rxLen = bufferLength;

^ permalink raw reply related	[flat|nested] 22+ messages in thread

end of thread, other threads:[~2019-05-02 15:44 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-05-01 21:33 [v2] USB: serial: io_edgeport: mark expected switch fall-throughs Gustavo A. R. Silva
2019-05-01 21:33 ` [PATCH v2] " Gustavo A. R. Silva
2019-05-02 10:26 ` [v2] " Johan Hovold
2019-05-02 10:26   ` [PATCH v2] " Johan Hovold
2019-05-02 13:22   ` [v2] " Gustavo A. R. Silva
2019-05-02 13:22     ` [PATCH v2] " Gustavo A. R. Silva
2019-05-02 13:56     ` [v2] " Johan Hovold
2019-05-02 13:56       ` [PATCH v2] " Johan Hovold
2019-05-02 14:28       ` [v2] " Gustavo A. R. Silva
2019-05-02 14:28         ` [PATCH v2] " Gustavo A. R. Silva
2019-05-02 14:40         ` [v2] " Greg Kroah-Hartman
2019-05-02 14:40           ` [PATCH v2] " Greg Kroah-Hartman
2019-05-02 14:47           ` [v2] " Greg Kroah-Hartman
2019-05-02 14:47             ` [PATCH v2] " Greg Kroah-Hartman
2019-05-02 14:57             ` [v2] " Gustavo A. R. Silva
2019-05-02 14:57               ` [PATCH v2] " Gustavo A. R. Silva
2019-05-02 15:04               ` [v2] " Greg Kroah-Hartman
2019-05-02 15:04                 ` [PATCH v2] " Greg Kroah-Hartman
2019-05-02 15:14             ` [v2] " Johan Hovold
2019-05-02 15:14               ` [PATCH v2] " Johan Hovold
2019-05-02 14:48           ` [v2] " Johan Hovold
2019-05-02 14:48             ` [PATCH v2] " Johan Hovold

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).