Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp4946065imu; Tue, 29 Jan 2019 10:07:21 -0800 (PST) X-Google-Smtp-Source: ALg8bN4ywxUY2hkG5eH/CMwcEX60WG9JXzdJpz6STC/HovvMkFib+t0LWHbtpUTfToiRTydgOdgX X-Received: by 2002:a62:18ce:: with SMTP id 197mr28065472pfy.88.1548785241159; Tue, 29 Jan 2019 10:07:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548785241; cv=none; d=google.com; s=arc-20160816; b=l2tgmyinNlPxzpLzDhVJKLn6cw/JU/r+JQV/XcZlAULiGqSHtz4xpTBZn5kTHvMTpy BlhbQeWrZ27CaI++4n7cUm2ZlUfswTWFMU6r3lLh9/x6f91fadZGpYb7iBtBjI2YKeUU 2k/aaQSZ3eEy/Mra3uDbe7AfzfESuPd+mgZ6Wp8w7aaLkWO/esoAPJaTrCv602ZA+uQb VjdlLsKI5Sc+mlOgPfw0DkJ5C3+55nFmgIbDxgn1Xsj0pWp5WjikrtANdqgpchi84bY/ /97xsw3Kj05cGZ0bbY+rZJX6f23wsIWLKfDSCCfmGpt5E1yRJZG8+y4nkqEGC4ccqHjk u+Bg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:content-transfer-encoding :content-disposition:mime-version:message-id:subject:cc:to:from:date; bh=HXHc0V8BVBDw1MRXB9TWHTXeBHyJf2ujQkI/BoT2a8c=; b=EeZgDaRskmO9FnO+9GU5mAvyNhSn+VoCJ9rAF4Il7LXxOUf3xSMuacNYGgZU/33E2w HExg/OgCs//DkpPsPN4hQoyfzbFPQNFD1il4QX4AcRXC037cBLOqMameGsynq4ODnf0k WT3sMbXyl5F6aW0yQmunWHyatask7jJs7qFreke07+F0lG6LIlUbNvsNlGPBWTa0WyaN k1uV0vr1QbgFzCVqMfHdJ0pfP+B/dSWJhsz1YiYuDc7CgFEFiY9UsJ2UoP4oMOyn3Rwy 70jzp++Hno5oNR6zXRPYdUy1eiF6YoFRxM1uv72Pz3crMRtDtqL6OwXnhWyq8DHOu9+7 o5iQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j66si2560286pfb.182.2019.01.29.10.07.00; Tue, 29 Jan 2019 10:07:21 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729132AbfA2SGX (ORCPT + 99 others); Tue, 29 Jan 2019 13:06:23 -0500 Received: from gateway21.websitewelcome.com ([192.185.45.250]:22192 "EHLO gateway21.websitewelcome.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728622AbfA2SGQ (ORCPT ); Tue, 29 Jan 2019 13:06:16 -0500 Received: from cm16.websitewelcome.com (cm16.websitewelcome.com [100.42.49.19]) by gateway21.websitewelcome.com (Postfix) with ESMTP id 29800400D9277 for ; Tue, 29 Jan 2019 12:06:15 -0600 (CST) Received: from gator4166.hostgator.com ([108.167.133.22]) by cmsmtp with SMTP id oXm3gpS554FKpoXm3gCtH4; Tue, 29 Jan 2019 12:06:15 -0600 X-Authority-Reason: nr=8 Received: from [189.250.130.205] (port=44894 helo=embeddedor) by gator4166.hostgator.com with esmtpa (Exim 4.91) (envelope-from ) id 1goXm2-0049dP-6P; Tue, 29 Jan 2019 12:06:14 -0600 Date: Tue, 29 Jan 2019 12:06:12 -0600 From: "Gustavo A. R. Silva" To: Wolfgang Grandegger , Marc Kleine-Budde , "David S. Miller" , Nicolas Ferre , Alexandre Belloni , Ludovic Desroches Cc: linux-can@vger.kernel.org, netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, "Gustavo A. R. Silva" Subject: [PATCH] can: mark expected switch fall-throughs Message-ID: <20190129180612.GA28650@embeddedor> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit User-Agent: Mutt/1.9.4 (2018-02-28) X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - gator4166.hostgator.com X-AntiAbuse: Original Domain - vger.kernel.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - embeddedor.com X-BWhitelist: no X-Source-IP: 189.250.130.205 X-Source-L: No X-Exim-ID: 1goXm2-0049dP-6P X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: (embeddedor) [189.250.130.205]:44894 X-Source-Auth: gustavo@embeddedor.com X-Email-Count: 10 X-Source-Cap: Z3V6aWRpbmU7Z3V6aWRpbmU7Z2F0b3I0MTY2Lmhvc3RnYXRvci5jb20= X-Local-Domain: yes Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- drivers/net/can/at91_can.c | 6 ++++-- drivers/net/can/peak_canfd/peak_pciefd_main.c | 2 +- drivers/net/can/spi/mcp251x.c | 3 ++- drivers/net/can/usb/peak_usb/pcan_usb.c | 2 +- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/drivers/net/can/at91_can.c b/drivers/net/can/at91_can.c index d98c69045b17..1718c20f9c99 100644 --- a/drivers/net/can/at91_can.c +++ b/drivers/net/can/at91_can.c @@ -902,7 +902,8 @@ static void at91_irq_err_state(struct net_device *dev, CAN_ERR_CRTL_TX_WARNING : CAN_ERR_CRTL_RX_WARNING; } - case CAN_STATE_ERROR_WARNING: /* fallthrough */ + /* fall through */ + case CAN_STATE_ERROR_WARNING: /* * from: ERROR_ACTIVE, ERROR_WARNING * to : ERROR_PASSIVE, BUS_OFF @@ -951,7 +952,8 @@ static void at91_irq_err_state(struct net_device *dev, netdev_dbg(dev, "Error Active\n"); cf->can_id |= CAN_ERR_PROT; cf->data[2] = CAN_ERR_PROT_ACTIVE; - case CAN_STATE_ERROR_WARNING: /* fallthrough */ + /* fall through */ + case CAN_STATE_ERROR_WARNING: reg_idr = AT91_IRQ_ERRA | AT91_IRQ_WARN | AT91_IRQ_BOFF; reg_ier = AT91_IRQ_ERRP; break; diff --git a/drivers/net/can/peak_canfd/peak_pciefd_main.c b/drivers/net/can/peak_canfd/peak_pciefd_main.c index c458d5fdc8d3..e4f4d65a76b4 100644 --- a/drivers/net/can/peak_canfd/peak_pciefd_main.c +++ b/drivers/net/can/peak_canfd/peak_pciefd_main.c @@ -668,7 +668,7 @@ static int pciefd_can_probe(struct pciefd_board *pciefd) pciefd_can_writereg(priv, CANFD_CLK_SEL_80MHZ, PCIEFD_REG_CAN_CLK_SEL); - /* fallthough */ + /* fall through */ case CANFD_CLK_SEL_80MHZ: priv->ucan.can.clock.freq = 80 * 1000 * 1000; break; diff --git a/drivers/net/can/spi/mcp251x.c b/drivers/net/can/spi/mcp251x.c index e90817608645..17257c73c302 100644 --- a/drivers/net/can/spi/mcp251x.c +++ b/drivers/net/can/spi/mcp251x.c @@ -875,7 +875,8 @@ static irqreturn_t mcp251x_can_ist(int irq, void *dev_id) if (new_state >= CAN_STATE_ERROR_WARNING && new_state <= CAN_STATE_BUS_OFF) priv->can.can_stats.error_warning++; - case CAN_STATE_ERROR_WARNING: /* fallthrough */ + /* fall through */ + case CAN_STATE_ERROR_WARNING: if (new_state >= CAN_STATE_ERROR_PASSIVE && new_state <= CAN_STATE_BUS_OFF) priv->can.can_stats.error_passive++; diff --git a/drivers/net/can/usb/peak_usb/pcan_usb.c b/drivers/net/can/usb/peak_usb/pcan_usb.c index 13238a72a338..eca785532b6b 100644 --- a/drivers/net/can/usb/peak_usb/pcan_usb.c +++ b/drivers/net/can/usb/peak_usb/pcan_usb.c @@ -423,7 +423,7 @@ static int pcan_usb_decode_error(struct pcan_usb_msg_context *mc, u8 n, new_state = CAN_STATE_ERROR_WARNING; break; } - /* else: fall through */ + /* fall through */ case CAN_STATE_ERROR_WARNING: if (n & PCAN_USB_ERROR_BUS_HEAVY) { -- 2.20.1