linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] can: mark expected switch fall-throughs
@ 2019-01-29 18:06 Gustavo A. R. Silva
  2019-01-30  8:11 ` Nicolas.Ferre
  2019-02-26  8:02 ` Marc Kleine-Budde
  0 siblings, 2 replies; 13+ messages in thread
From: Gustavo A. R. Silva @ 2019-01-29 18:06 UTC (permalink / raw)
  To: Wolfgang Grandegger, Marc Kleine-Budde, David S. Miller,
	Nicolas Ferre, Alexandre Belloni, Ludovic Desroches
  Cc: linux-can, netdev, linux-arm-kernel, linux-kernel, Gustavo A. R. Silva

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 ++++--
 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


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

* Re: [PATCH] can: mark expected switch fall-throughs
  2019-01-29 18:06 [PATCH] can: mark expected switch fall-throughs Gustavo A. R. Silva
@ 2019-01-30  8:11 ` Nicolas.Ferre
  2019-02-14 21:37   ` Gustavo A. R. Silva
  2019-02-26  8:02 ` Marc Kleine-Budde
  1 sibling, 1 reply; 13+ messages in thread
From: Nicolas.Ferre @ 2019-01-30  8:11 UTC (permalink / raw)
  To: gustavo, wg, mkl, davem, alexandre.belloni, Ludovic.Desroches
  Cc: linux-can, netdev, linux-arm-kernel, linux-kernel

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>

>   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) {
> 


-- 
Nicolas Ferre

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

* Re: [PATCH] can: mark expected switch fall-throughs
  2019-01-30  8:11 ` Nicolas.Ferre
@ 2019-02-14 21:37   ` Gustavo A. R. Silva
  2019-02-14 22:17     ` Alexandre Belloni
  2019-02-19  2:57     ` Gustavo A. R. Silva
  0 siblings, 2 replies; 13+ messages in thread
From: Gustavo A. R. Silva @ 2019-02-14 21:37 UTC (permalink / raw)
  To: Nicolas.Ferre, wg, mkl, davem, alexandre.belloni, Ludovic.Desroches
  Cc: linux-can, netdev, linux-arm-kernel, linux-kernel



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.

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 */
>> +		/* 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) {
>>
> 
> 

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

* Re: [PATCH] can: mark expected switch fall-throughs
  2019-02-14 21:37   ` Gustavo A. R. Silva
@ 2019-02-14 22:17     ` Alexandre Belloni
  2019-02-14 23:04       ` Gustavo A. R. Silva
  2019-02-19  2:57     ` Gustavo A. R. Silva
  1 sibling, 1 reply; 13+ messages in thread
From: Alexandre Belloni @ 2019-02-14 22:17 UTC (permalink / raw)
  To: Gustavo A. R. Silva
  Cc: Nicolas.Ferre, wg, mkl, davem, Ludovic.Desroches, linux-can,
	netdev, linux-arm-kernel, linux-kernel

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.

> 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
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).

The matching regex is [ \t.!]*([Ee]lse,? |[Ii]ntentional(ly)? )?
fall(s | |-)?thr(ough|u)[ \t.!]*(-[^\n\r]*)?

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

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

* Re: [PATCH] can: mark expected switch fall-throughs
  2019-02-14 22:17     ` Alexandre Belloni
@ 2019-02-14 23:04       ` Gustavo A. R. Silva
  2019-02-14 23:07         ` Alexandre Belloni
  0 siblings, 1 reply; 13+ messages in thread
From: Gustavo A. R. Silva @ 2019-02-14 23:04 UTC (permalink / raw)
  To: Alexandre Belloni
  Cc: Nicolas.Ferre, wg, mkl, davem, Ludovic.Desroches, linux-can,
	netdev, linux-arm-kernel, linux-kernel, Kees Cook



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.

Thanks
--
Gustavo

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

* Re: [PATCH] can: mark expected switch fall-throughs
  2019-02-14 23:04       ` Gustavo A. R. Silva
@ 2019-02-14 23:07         ` Alexandre Belloni
  2019-02-14 23:14           ` Gustavo A. R. Silva
  0 siblings, 1 reply; 13+ messages in thread
From: Alexandre Belloni @ 2019-02-14 23:07 UTC (permalink / raw)
  To: Gustavo A. R. Silva
  Cc: Nicolas.Ferre, wg, mkl, davem, Ludovic.Desroches, linux-can,
	netdev, linux-arm-kernel, linux-kernel, Kees Cook

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

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

* Re: [PATCH] can: mark expected switch fall-throughs
  2019-02-14 23:07         ` Alexandre Belloni
@ 2019-02-14 23:14           ` Gustavo A. R. Silva
  2019-02-14 23:21             ` Alexandre Belloni
  0 siblings, 1 reply; 13+ messages in thread
From: Gustavo A. R. Silva @ 2019-02-14 23:14 UTC (permalink / raw)
  To: Alexandre Belloni
  Cc: Nicolas.Ferre, wg, mkl, davem, Ludovic.Desroches, linux-can,
	netdev, linux-arm-kernel, linux-kernel, Kees Cook



On 2/14/19 5:07 PM, Alexandre Belloni wrote:
> 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.
> 

Yeah. But, again, you are missing the relevant part of the patch.

--
Gustavo

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

* Re: [PATCH] can: mark expected switch fall-throughs
  2019-02-14 23:14           ` Gustavo A. R. Silva
@ 2019-02-14 23:21             ` Alexandre Belloni
  0 siblings, 0 replies; 13+ messages in thread
From: Alexandre Belloni @ 2019-02-14 23:21 UTC (permalink / raw)
  To: Gustavo A. R. Silva
  Cc: Nicolas.Ferre, wg, mkl, davem, Ludovic.Desroches, linux-can,
	netdev, linux-arm-kernel, linux-kernel, Kees Cook

On 14/02/2019 17:14:05-0600, Gustavo A. R. Silva wrote:
> >>> 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.
> > 
> 
> Yeah. But, again, you are missing the relevant part of the patch.
> 

Right, I misread the patch and though you were moving the comment after
the case statement.


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

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

* Re: [PATCH] can: mark expected switch fall-throughs
  2019-02-14 21:37   ` Gustavo A. R. Silva
  2019-02-14 22:17     ` Alexandre Belloni
@ 2019-02-19  2:57     ` Gustavo A. R. Silva
  1 sibling, 0 replies; 13+ messages in thread
From: Gustavo A. R. Silva @ 2019-02-19  2:57 UTC (permalink / raw)
  To: Nicolas.Ferre, wg, mkl, davem, alexandre.belloni, Ludovic.Desroches
  Cc: linux-can, netdev, linux-arm-kernel, linux-kernel, Kees Cook

Hi,

Friendly ping:

Dave, I wonder if you can take this.

Thanks
--
Gustavo

On 2/14/19 3:37 PM, 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.
> 
> 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 */
>>> +		/* 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) {
>>>
>>
>>

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

* Re: [PATCH] can: mark expected switch fall-throughs
  2019-01-29 18:06 [PATCH] can: mark expected switch fall-throughs Gustavo A. R. Silva
  2019-01-30  8:11 ` Nicolas.Ferre
@ 2019-02-26  8:02 ` Marc Kleine-Budde
  2019-02-26 15:24   ` Gustavo A. R. Silva
  2019-05-08 17:30   ` Gustavo A. R. Silva
  1 sibling, 2 replies; 13+ messages in thread
From: Marc Kleine-Budde @ 2019-02-26  8:02 UTC (permalink / raw)
  To: Gustavo A. R. Silva, Wolfgang Grandegger, David S. Miller,
	Nicolas Ferre, Alexandre Belloni, Ludovic Desroches
  Cc: linux-can, netdev, linux-arm-kernel, linux-kernel

On 1/29/19 7:06 PM, 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>

Added to linux-can-next.

Tnx
Marc

-- 
Pengutronix e.K.                  | Marc Kleine-Budde           |
Industrial Linux Solutions        | Phone: +49-231-2826-924     |
Vertretung West/Dortmund          | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |

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

* Re: [PATCH] can: mark expected switch fall-throughs
  2019-02-26  8:02 ` Marc Kleine-Budde
@ 2019-02-26 15:24   ` Gustavo A. R. Silva
  2019-05-08 17:30   ` Gustavo A. R. Silva
  1 sibling, 0 replies; 13+ messages in thread
From: Gustavo A. R. Silva @ 2019-02-26 15:24 UTC (permalink / raw)
  To: Marc Kleine-Budde, Wolfgang Grandegger, David S. Miller,
	Nicolas Ferre, Alexandre Belloni, Ludovic Desroches
  Cc: linux-can, netdev, linux-arm-kernel, linux-kernel



On 2/26/19 2:02 AM, Marc Kleine-Budde wrote:
> On 1/29/19 7:06 PM, 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>
> 
> Added to linux-can-next.
> 

Thanks, Marc.

--
Gustavo

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

* Re: [PATCH] can: mark expected switch fall-throughs
  2019-02-26  8:02 ` Marc Kleine-Budde
  2019-02-26 15:24   ` Gustavo A. R. Silva
@ 2019-05-08 17:30   ` Gustavo A. R. Silva
  2019-05-21 19:06     ` Gustavo A. R. Silva
  1 sibling, 1 reply; 13+ messages in thread
From: Gustavo A. R. Silva @ 2019-05-08 17:30 UTC (permalink / raw)
  To: Marc Kleine-Budde, Wolfgang Grandegger, David S. Miller,
	Nicolas Ferre, Alexandre Belloni, Ludovic Desroches
  Cc: linux-can, netdev, linux-arm-kernel, linux-kernel, Kees Cook

Hi Marc,

On 2/26/19 2:02 AM, Marc Kleine-Budde wrote:
> On 1/29/19 7:06 PM, 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>
> 
> Added to linux-can-next.
> 

I wonder if there is any chance for this patch to be queued up for 5.2-rc1.

Thanks
--
Gustavo

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

* Re: [PATCH] can: mark expected switch fall-throughs
  2019-05-08 17:30   ` Gustavo A. R. Silva
@ 2019-05-21 19:06     ` Gustavo A. R. Silva
  0 siblings, 0 replies; 13+ messages in thread
From: Gustavo A. R. Silva @ 2019-05-21 19:06 UTC (permalink / raw)
  To: Marc Kleine-Budde, Wolfgang Grandegger, David S. Miller,
	Nicolas Ferre, Alexandre Belloni, Ludovic Desroches
  Cc: linux-can, netdev, linux-arm-kernel, linux-kernel, Kees Cook

Hi Marc,

This patch has been in linux-can-next since February, but for some reason
it hasn't been merged into net yet, not even once into linux-next.

I can add it to my tree if you don't mind.

Thanks
--
Gustavo

On 5/8/19 12:30 PM, Gustavo A. R. Silva wrote:
> Hi Marc,
> 
> On 2/26/19 2:02 AM, Marc Kleine-Budde wrote:
>> On 1/29/19 7:06 PM, 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>
>>
>> Added to linux-can-next.
>>
> 
> I wonder if there is any chance for this patch to be queued up for 5.2-rc1.
> 
> Thanks
> --
> Gustavo
> 

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

end of thread, other threads:[~2019-05-21 19:07 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-29 18:06 [PATCH] can: mark expected switch fall-throughs Gustavo A. R. Silva
2019-01-30  8:11 ` Nicolas.Ferre
2019-02-14 21:37   ` Gustavo A. R. Silva
2019-02-14 22:17     ` Alexandre Belloni
2019-02-14 23:04       ` Gustavo A. R. Silva
2019-02-14 23:07         ` Alexandre Belloni
2019-02-14 23:14           ` Gustavo A. R. Silva
2019-02-14 23:21             ` Alexandre Belloni
2019-02-19  2:57     ` Gustavo A. R. Silva
2019-02-26  8:02 ` Marc Kleine-Budde
2019-02-26 15:24   ` Gustavo A. R. Silva
2019-05-08 17:30   ` Gustavo A. R. Silva
2019-05-21 19:06     ` Gustavo A. R. Silva

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).