Skip to content

Commit b07fbf2

Browse files
GustavoARSilvamarckleinebudde
authored andcommitted
can: mark expected switch fall-throughs
In preparation to enabling -Wimplicit-fallthrough, mark switch cases where we are expecting to fall through. This patch fixes the following warnings: drivers/net/can/peak_canfd/peak_pciefd_main.c:668:3: warning: this statement may fall through [-Wimplicit-fallthrough=] drivers/net/can/spi/mcp251x.c:875:7: warning: this statement may fall through [-Wimplicit-fallthrough=] drivers/net/can/usb/peak_usb/pcan_usb.c:422:6: warning: this statement may fall through [-Wimplicit-fallthrough=] drivers/net/can/at91_can.c:895:6: warning: this statement may fall through [-Wimplicit-fallthrough=] drivers/net/can/at91_can.c:953:15: warning: this statement may fall through [-Wimplicit-fallthrough=] drivers/net/can/usb/peak_usb/pcan_usb.c: In function ‘pcan_usb_decode_error’: drivers/net/can/usb/peak_usb/pcan_usb.c:422:6: warning: this statement may fall through [-Wimplicit-fallthrough=] if (n & PCAN_USB_ERROR_BUS_LIGHT) { ^ drivers/net/can/usb/peak_usb/pcan_usb.c:428:2: note: here case CAN_STATE_ERROR_WARNING: ^~~~ Warning level 3 was used: -Wimplicit-fallthrough=3 This patch is part of the ongoing efforts to enabling -Wimplicit-fallthrough. Notice that in some cases spelling mistakes were fixed. In other cases, the /* fall through */ comment is placed at the bottom of the case statement, which is what GCC is expecting to find. Signed-off-by: Gustavo A. R. Silva <[email protected]> Acked-by: Nicolas Ferre <[email protected]> # for the at91_can.c Signed-off-by: Marc Kleine-Budde <[email protected]>
1 parent 26ad340 commit b07fbf2

File tree

4 files changed

+8
-5
lines changed

4 files changed

+8
-5
lines changed

drivers/net/can/at91_can.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -898,7 +898,8 @@ static void at91_irq_err_state(struct net_device *dev,
898898
CAN_ERR_CRTL_TX_WARNING :
899899
CAN_ERR_CRTL_RX_WARNING;
900900
}
901-
case CAN_STATE_ERROR_WARNING: /* fallthrough */
901+
/* fall through */
902+
case CAN_STATE_ERROR_WARNING:
902903
/*
903904
* from: ERROR_ACTIVE, ERROR_WARNING
904905
* to : ERROR_PASSIVE, BUS_OFF
@@ -947,7 +948,8 @@ static void at91_irq_err_state(struct net_device *dev,
947948
netdev_dbg(dev, "Error Active\n");
948949
cf->can_id |= CAN_ERR_PROT;
949950
cf->data[2] = CAN_ERR_PROT_ACTIVE;
950-
case CAN_STATE_ERROR_WARNING: /* fallthrough */
951+
/* fall through */
952+
case CAN_STATE_ERROR_WARNING:
951953
reg_idr = AT91_IRQ_ERRA | AT91_IRQ_WARN | AT91_IRQ_BOFF;
952954
reg_ier = AT91_IRQ_ERRP;
953955
break;

drivers/net/can/peak_canfd/peak_pciefd_main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -660,7 +660,7 @@ static int pciefd_can_probe(struct pciefd_board *pciefd)
660660
pciefd_can_writereg(priv, CANFD_CLK_SEL_80MHZ,
661661
PCIEFD_REG_CAN_CLK_SEL);
662662

663-
/* fallthough */
663+
/* fall through */
664664
case CANFD_CLK_SEL_80MHZ:
665665
priv->ucan.can.clock.freq = 80 * 1000 * 1000;
666666
break;

drivers/net/can/spi/mcp251x.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -860,7 +860,8 @@ static irqreturn_t mcp251x_can_ist(int irq, void *dev_id)
860860
if (new_state >= CAN_STATE_ERROR_WARNING &&
861861
new_state <= CAN_STATE_BUS_OFF)
862862
priv->can.can_stats.error_warning++;
863-
case CAN_STATE_ERROR_WARNING: /* fallthrough */
863+
/* fall through */
864+
case CAN_STATE_ERROR_WARNING:
864865
if (new_state >= CAN_STATE_ERROR_PASSIVE &&
865866
new_state <= CAN_STATE_BUS_OFF)
866867
priv->can.can_stats.error_passive++;

drivers/net/can/usb/peak_usb/pcan_usb.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,7 @@ static int pcan_usb_decode_error(struct pcan_usb_msg_context *mc, u8 n,
415415
new_state = CAN_STATE_ERROR_WARNING;
416416
break;
417417
}
418-
/* else: fall through */
418+
/* fall through */
419419

420420
case CAN_STATE_ERROR_WARNING:
421421
if (n & PCAN_USB_ERROR_BUS_HEAVY) {

0 commit comments

Comments
 (0)