All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexandre Belloni <alexandre.belloni@bootlin.com>
To: "Gustavo A. R. Silva" <gustavo@embeddedor.com>
Cc: Nicolas.Ferre@microchip.com, wg@grandegger.com,
	mkl@pengutronix.de, davem@davemloft.net,
	Ludovic.Desroches@microchip.com, linux-can@vger.kernel.org,
	netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, Kees Cook <keescook@chromium.org>
Subject: Re: [PATCH] can: mark expected switch fall-throughs
Date: Fri, 15 Feb 2019 00:07:56 +0100	[thread overview]
Message-ID: <20190214230756.GR10129@piout.net> (raw)
In-Reply-To: <a8e53868-2b13-b050-7714-e3e24d18cf00@embeddedor.com>

On 14/02/2019 17:04:03-0600, Gustavo A. R. Silva wrote:
> 
> 
> On 2/14/19 4:17 PM, Alexandre Belloni wrote:
> > Hi,
> > 
> > On 14/02/2019 15:37:26-0600, Gustavo A. R. Silva wrote:
> >>
> >>
> >> On 1/30/19 2:11 AM, Nicolas.Ferre@microchip.com wrote:
> >>> On 29/01/2019 at 19:06, Gustavo A. R. Silva wrote:
> >>>> 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 <gustavo@embeddedor.com>
> >>>> ---
> >>>>   drivers/net/can/at91_can.c                    | 6 ++++--
> >>>
> >>> For this one:
> >>> Acked-by: Nicolas Ferre <nicolas.ferre@microchip.com>
> >>>
> >>
> >> Thanks, Nicolas.
> >>
> > 
> > I though I had a déjà vu but you actually sent the at91 part twice.
> > 
> 
> It wasn't intentional.
> 
> >> Dave:
> >>
> >> I wonder if you can take this patch.
> >>
> >> Thanks
> >> --
> >> Gustavo
> >>
> >>>>   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 */
> > 
> > Seriously, for that one, you should fix the compiler. The fall through
> 
> I'll pass your feedback on to the GCC guys.
> 
> > is not implicit, it is actually quite explicit and the warning is simply
> > wrong.
> > 
> > Also, the gcc documentation says that -Wimplicit-fallthrough=3
> > recognizes /* fallthrough */ as a proper fall through comment (and I
> > tested with gcc 8.2).
> > 
> 
> Yeah. But that's not the relevant change in this case.  Notice that the
> comment was moved to the very bottom of the previous case.
> 

Yes and it doesn't matter for gcc, I tested with gcc 8.2.

-- 
Alexandre Belloni, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

WARNING: multiple messages have this Message-ID (diff)
From: Alexandre Belloni <alexandre.belloni@bootlin.com>
To: "Gustavo A. R. Silva" <gustavo@embeddedor.com>
Cc: linux-kernel@vger.kernel.org, Kees Cook <keescook@chromium.org>,
	netdev@vger.kernel.org, linux-can@vger.kernel.org,
	Ludovic.Desroches@microchip.com, mkl@pengutronix.de,
	linux-arm-kernel@lists.infradead.org, davem@davemloft.net,
	wg@grandegger.com
Subject: Re: [PATCH] can: mark expected switch fall-throughs
Date: Fri, 15 Feb 2019 00:07:56 +0100	[thread overview]
Message-ID: <20190214230756.GR10129@piout.net> (raw)
In-Reply-To: <a8e53868-2b13-b050-7714-e3e24d18cf00@embeddedor.com>

On 14/02/2019 17:04:03-0600, Gustavo A. R. Silva wrote:
> 
> 
> On 2/14/19 4:17 PM, Alexandre Belloni wrote:
> > Hi,
> > 
> > On 14/02/2019 15:37:26-0600, Gustavo A. R. Silva wrote:
> >>
> >>
> >> On 1/30/19 2:11 AM, Nicolas.Ferre@microchip.com wrote:
> >>> On 29/01/2019 at 19:06, Gustavo A. R. Silva wrote:
> >>>> 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 <gustavo@embeddedor.com>
> >>>> ---
> >>>>   drivers/net/can/at91_can.c                    | 6 ++++--
> >>>
> >>> For this one:
> >>> Acked-by: Nicolas Ferre <nicolas.ferre@microchip.com>
> >>>
> >>
> >> Thanks, Nicolas.
> >>
> > 
> > I though I had a déjà vu but you actually sent the at91 part twice.
> > 
> 
> It wasn't intentional.
> 
> >> Dave:
> >>
> >> I wonder if you can take this patch.
> >>
> >> Thanks
> >> --
> >> Gustavo
> >>
> >>>>   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 */
> > 
> > Seriously, for that one, you should fix the compiler. The fall through
> 
> I'll pass your feedback on to the GCC guys.
> 
> > is not implicit, it is actually quite explicit and the warning is simply
> > wrong.
> > 
> > Also, the gcc documentation says that -Wimplicit-fallthrough=3
> > recognizes /* fallthrough */ as a proper fall through comment (and I
> > tested with gcc 8.2).
> > 
> 
> Yeah. But that's not the relevant change in this case.  Notice that the
> comment was moved to the very bottom of the previous case.
> 

Yes and it doesn't matter for gcc, I tested with gcc 8.2.

-- 
Alexandre Belloni, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2019-02-14 23:07 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-29 18:06 [PATCH] can: mark expected switch fall-throughs Gustavo A. R. Silva
2019-01-29 18:06 ` Gustavo A. R. Silva
2019-01-30  8:11 ` Nicolas.Ferre
2019-01-30  8:11   ` Nicolas.Ferre
2019-01-30  8:11   ` Nicolas.Ferre
2019-02-14 21:37   ` Gustavo A. R. Silva
2019-02-14 21:37     ` Gustavo A. R. Silva
2019-02-14 22:17     ` Alexandre Belloni
2019-02-14 22:17       ` Alexandre Belloni
2019-02-14 23:04       ` Gustavo A. R. Silva
2019-02-14 23:04         ` Gustavo A. R. Silva
2019-02-14 23:07         ` Alexandre Belloni [this message]
2019-02-14 23:07           ` Alexandre Belloni
2019-02-14 23:14           ` Gustavo A. R. Silva
2019-02-14 23:14             ` Gustavo A. R. Silva
2019-02-14 23:14             ` Gustavo A. R. Silva
2019-02-14 23:21             ` Alexandre Belloni
2019-02-14 23:21               ` Alexandre Belloni
2019-02-19  2:57     ` Gustavo A. R. Silva
2019-02-19  2:57       ` Gustavo A. R. Silva
2019-02-26  8:02 ` Marc Kleine-Budde
2019-02-26  8:02   ` Marc Kleine-Budde
2019-02-26 15:24   ` Gustavo A. R. Silva
2019-02-26 15:24     ` Gustavo A. R. Silva
2019-05-08 17:30   ` Gustavo A. R. Silva
2019-05-08 17:30     ` Gustavo A. R. Silva
2019-05-08 17:30     ` Gustavo A. R. Silva
2019-05-21 19:06     ` Gustavo A. R. Silva
2019-05-21 19:06       ` Gustavo A. R. Silva

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190214230756.GR10129@piout.net \
    --to=alexandre.belloni@bootlin.com \
    --cc=Ludovic.Desroches@microchip.com \
    --cc=Nicolas.Ferre@microchip.com \
    --cc=davem@davemloft.net \
    --cc=gustavo@embeddedor.com \
    --cc=keescook@chromium.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-can@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mkl@pengutronix.de \
    --cc=netdev@vger.kernel.org \
    --cc=wg@grandegger.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.