]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
tty: n_gsm: Mark expected switch fall-throughs
authorGustavo A. R. Silva <gustavo@embeddedor.com>
Mon, 25 Feb 2019 17:28:14 +0000 (11:28 -0600)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 26 Feb 2019 11:30:44 +0000 (12:30 +0100)
In preparation to enabling -Wimplicit-fallthrough, mark switch
cases where we are expecting to fall through.

This patch fixes the following warnings:

drivers/tty/n_gsm.c: In function ‘gsm_dlci_data’:
drivers/tty/n_gsm.c:1582:6: warning: this statement may fall through [-Wimplicit-fallthrough=]
   if (tty) {
      ^
drivers/tty/n_gsm.c:1587:2: note: here
  case 1:
  ^~~~
drivers/tty/n_gsm.c: In function ‘gsm1_receive’:
  CC [M]  drivers/scsi/snic/snic_disc.o
  CC [M]  drivers/net/wireless/realtek/rtlwifi/pci.o
  CC      drivers/usb/early/xhci-dbc.o
drivers/tty/n_gsm.c:1981:12: warning: this statement may fall through [-Wimplicit-fallthrough=]
   gsm->fcs = INIT_FCS;
            ^
drivers/tty/n_gsm.c:1983:2: note: here
  case GSM_ADDRESS: /* Address continuation */
  ^~~~

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

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.

Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/n_gsm.c

index d9662848a297e3206387bb2d7511982c0de2755c..c4e16b31f9ab3d5cbd76f961b019b5505fd9cdfe 100644 (file)
@@ -1565,14 +1565,11 @@ static void gsm_dlci_data(struct gsm_dlci *dlci, const u8 *data, int clen)
                pr_debug("%d bytes for tty\n", len);
        switch (dlci->adaption)  {
        /* Unsupported types */
-       /* Packetised interruptible data */
-       case 4:
+       case 4:         /* Packetised interruptible data */
                break;
-       /* Packetised uininterruptible voice/data */
-       case 3:
+       case 3:         /* Packetised uininterruptible voice/data */
                break;
-       /* Asynchronous serial with line state in each frame */
-       case 2:
+       case 2:         /* Asynchronous serial with line state in each frame */
                while (gsm_read_ea(&modem, *data++) == 0) {
                        len--;
                        if (len == 0)
@@ -1583,8 +1580,8 @@ static void gsm_dlci_data(struct gsm_dlci *dlci, const u8 *data, int clen)
                        gsm_process_modem(tty, dlci, modem, clen);
                        tty_kref_put(tty);
                }
-       /* Line state will go via DLCI 0 controls only */
-       case 1:
+               /* Fall through */
+       case 1:         /* Line state will go via DLCI 0 controls only */
        default:
                tty_insert_flip_string(port, data, len);
                tty_flip_buffer_push(port);
@@ -1979,7 +1976,7 @@ static void gsm1_receive(struct gsm_mux *gsm, unsigned char c)
                gsm->address = 0;
                gsm->state = GSM_ADDRESS;
                gsm->fcs = INIT_FCS;
-               /* Drop through */
+               /* Fall through */
        case GSM_ADDRESS:       /* Address continuation */
                gsm->fcs = gsm_fcs_add(gsm->fcs, c);
                if (gsm_read_ea(&gsm->address, c))