All of lore.kernel.org
 help / color / mirror / Atom feed
* USB: serial: io_edgeport: fix up switch fall-through comments
@ 2019-05-02 17:35 ` Greg Kroah-Hartman
  0 siblings, 0 replies; 10+ messages in thread
From: Greg Kroah-Hartman @ 2019-05-02 17:35 UTC (permalink / raw)
  To: Johan Hovold; +Cc: linux-usb, Gustavo A. R. Silva

Gustavo has been working to fix up all of the switch statements that
"fall through" such that we can eventually turn on
-Wimplicit-fallthrough.  As part of that, the io_edgeport.c driver is a
bit "messy" with the parsing logic of a data packet.  Clean that logic
up a bit by unindenting one level of the logic, and properly label
/* Fall through */ to make gcc happy.

Reported-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

diff --git a/drivers/usb/serial/io_edgeport.c b/drivers/usb/serial/io_edgeport.c
index 4ca31c0e4174..48a439298a68 100644
--- a/drivers/usb/serial/io_edgeport.c
+++ b/drivers/usb/serial/io_edgeport.c
@@ -1751,7 +1751,7 @@ static void process_rcvd_data(struct edgeport_serial *edge_serial,
 				edge_serial->rxState = EXPECT_HDR2;
 				break;
 			}
-			/* otherwise, drop on through */
+			/* Fall through */
 		case EXPECT_HDR2:
 			edge_serial->rxHeader2 = *buffer;
 			++buffer;
@@ -1790,29 +1790,20 @@ static void process_rcvd_data(struct edgeport_serial *edge_serial,
 						edge_serial->rxHeader2, 0);
 				edge_serial->rxState = EXPECT_HDR1;
 				break;
-			} else {
-				edge_serial->rxPort =
-				    IOSP_GET_HDR_PORT(edge_serial->rxHeader1);
-				edge_serial->rxBytesRemaining =
-				    IOSP_GET_HDR_DATA_LEN(
-						edge_serial->rxHeader1,
-						edge_serial->rxHeader2);
-				dev_dbg(dev, "%s - Data for Port %u Len %u\n",
-					__func__,
-					edge_serial->rxPort,
-					edge_serial->rxBytesRemaining);
-
-				/* ASSERT(DevExt->RxPort < DevExt->NumPorts);
-				 * ASSERT(DevExt->RxBytesRemaining <
-				 *		IOSP_MAX_DATA_LENGTH);
-				 */
-
-				if (bufferLength == 0) {
-					edge_serial->rxState = EXPECT_DATA;
-					break;
-				}
-				/* Else, drop through */
 			}
+
+			edge_serial->rxPort = IOSP_GET_HDR_PORT(edge_serial->rxHeader1);
+			edge_serial->rxBytesRemaining = IOSP_GET_HDR_DATA_LEN(edge_serial->rxHeader1,
+									      edge_serial->rxHeader2);
+			dev_dbg(dev, "%s - Data for Port %u Len %u\n", __func__,
+				edge_serial->rxPort,
+				edge_serial->rxBytesRemaining);
+
+			if (bufferLength == 0) {
+				edge_serial->rxState = EXPECT_DATA;
+				break;
+			}
+			/* Fall through */
 		case EXPECT_DATA: /* Expect data */
 			if (bufferLength < edge_serial->rxBytesRemaining) {
 				rxLen = bufferLength;

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

* [PATCH] USB: serial: io_edgeport: fix up switch fall-through comments
@ 2019-05-02 17:35 ` Greg Kroah-Hartman
  0 siblings, 0 replies; 10+ messages in thread
From: Greg Kroah-Hartman @ 2019-05-02 17:35 UTC (permalink / raw)
  To: Johan Hovold; +Cc: linux-usb, Gustavo A. R. Silva

Gustavo has been working to fix up all of the switch statements that
"fall through" such that we can eventually turn on
-Wimplicit-fallthrough.  As part of that, the io_edgeport.c driver is a
bit "messy" with the parsing logic of a data packet.  Clean that logic
up a bit by unindenting one level of the logic, and properly label
/* Fall through */ to make gcc happy.

Reported-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

diff --git a/drivers/usb/serial/io_edgeport.c b/drivers/usb/serial/io_edgeport.c
index 4ca31c0e4174..48a439298a68 100644
--- a/drivers/usb/serial/io_edgeport.c
+++ b/drivers/usb/serial/io_edgeport.c
@@ -1751,7 +1751,7 @@ static void process_rcvd_data(struct edgeport_serial *edge_serial,
 				edge_serial->rxState = EXPECT_HDR2;
 				break;
 			}
-			/* otherwise, drop on through */
+			/* Fall through */
 		case EXPECT_HDR2:
 			edge_serial->rxHeader2 = *buffer;
 			++buffer;
@@ -1790,29 +1790,20 @@ static void process_rcvd_data(struct edgeport_serial *edge_serial,
 						edge_serial->rxHeader2, 0);
 				edge_serial->rxState = EXPECT_HDR1;
 				break;
-			} else {
-				edge_serial->rxPort =
-				    IOSP_GET_HDR_PORT(edge_serial->rxHeader1);
-				edge_serial->rxBytesRemaining =
-				    IOSP_GET_HDR_DATA_LEN(
-						edge_serial->rxHeader1,
-						edge_serial->rxHeader2);
-				dev_dbg(dev, "%s - Data for Port %u Len %u\n",
-					__func__,
-					edge_serial->rxPort,
-					edge_serial->rxBytesRemaining);
-
-				/* ASSERT(DevExt->RxPort < DevExt->NumPorts);
-				 * ASSERT(DevExt->RxBytesRemaining <
-				 *		IOSP_MAX_DATA_LENGTH);
-				 */
-
-				if (bufferLength == 0) {
-					edge_serial->rxState = EXPECT_DATA;
-					break;
-				}
-				/* Else, drop through */
 			}
+
+			edge_serial->rxPort = IOSP_GET_HDR_PORT(edge_serial->rxHeader1);
+			edge_serial->rxBytesRemaining = IOSP_GET_HDR_DATA_LEN(edge_serial->rxHeader1,
+									      edge_serial->rxHeader2);
+			dev_dbg(dev, "%s - Data for Port %u Len %u\n", __func__,
+				edge_serial->rxPort,
+				edge_serial->rxBytesRemaining);
+
+			if (bufferLength == 0) {
+				edge_serial->rxState = EXPECT_DATA;
+				break;
+			}
+			/* Fall through */
 		case EXPECT_DATA: /* Expect data */
 			if (bufferLength < edge_serial->rxBytesRemaining) {
 				rxLen = bufferLength;

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

* USB: serial: io_edgeport: fix up switch fall-through comments
@ 2019-05-02 17:45 ` Gustavo A. R. Silva
  0 siblings, 0 replies; 10+ messages in thread
From: Gustavo A. R. Silva @ 2019-05-02 17:45 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Johan Hovold; +Cc: linux-usb

On 5/2/19 12:35 PM, Greg Kroah-Hartman wrote:
> Gustavo has been working to fix up all of the switch statements that
> "fall through" such that we can eventually turn on
> -Wimplicit-fallthrough.  As part of that, the io_edgeport.c driver is a
> bit "messy" with the parsing logic of a data packet.  Clean that logic
> up a bit by unindenting one level of the logic, and properly label
> /* Fall through */ to make gcc happy.
> 
> Reported-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> 

Acked-by: Gustavo A. R. Silva <gustavo@embeddedor.com>


Thanks, Greg.
---
Gustavo

> diff --git a/drivers/usb/serial/io_edgeport.c b/drivers/usb/serial/io_edgeport.c
> index 4ca31c0e4174..48a439298a68 100644
> --- a/drivers/usb/serial/io_edgeport.c
> +++ b/drivers/usb/serial/io_edgeport.c
> @@ -1751,7 +1751,7 @@ static void process_rcvd_data(struct edgeport_serial *edge_serial,
>  				edge_serial->rxState = EXPECT_HDR2;
>  				break;
>  			}
> -			/* otherwise, drop on through */
> +			/* Fall through */
>  		case EXPECT_HDR2:
>  			edge_serial->rxHeader2 = *buffer;
>  			++buffer;
> @@ -1790,29 +1790,20 @@ static void process_rcvd_data(struct edgeport_serial *edge_serial,
>  						edge_serial->rxHeader2, 0);
>  				edge_serial->rxState = EXPECT_HDR1;
>  				break;
> -			} else {
> -				edge_serial->rxPort =
> -				    IOSP_GET_HDR_PORT(edge_serial->rxHeader1);
> -				edge_serial->rxBytesRemaining =
> -				    IOSP_GET_HDR_DATA_LEN(
> -						edge_serial->rxHeader1,
> -						edge_serial->rxHeader2);
> -				dev_dbg(dev, "%s - Data for Port %u Len %u\n",
> -					__func__,
> -					edge_serial->rxPort,
> -					edge_serial->rxBytesRemaining);
> -
> -				/* ASSERT(DevExt->RxPort < DevExt->NumPorts);
> -				 * ASSERT(DevExt->RxBytesRemaining <
> -				 *		IOSP_MAX_DATA_LENGTH);
> -				 */
> -
> -				if (bufferLength == 0) {
> -					edge_serial->rxState = EXPECT_DATA;
> -					break;
> -				}
> -				/* Else, drop through */
>  			}
> +
> +			edge_serial->rxPort = IOSP_GET_HDR_PORT(edge_serial->rxHeader1);
> +			edge_serial->rxBytesRemaining = IOSP_GET_HDR_DATA_LEN(edge_serial->rxHeader1,
> +									      edge_serial->rxHeader2);
> +			dev_dbg(dev, "%s - Data for Port %u Len %u\n", __func__,
> +				edge_serial->rxPort,
> +				edge_serial->rxBytesRemaining);
> +
> +			if (bufferLength == 0) {
> +				edge_serial->rxState = EXPECT_DATA;
> +				break;
> +			}
> +			/* Fall through */
>  		case EXPECT_DATA: /* Expect data */
>  			if (bufferLength < edge_serial->rxBytesRemaining) {
>  				rxLen = bufferLength;
>

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

* Re: [PATCH] USB: serial: io_edgeport: fix up switch fall-through comments
@ 2019-05-02 17:45 ` Gustavo A. R. Silva
  0 siblings, 0 replies; 10+ messages in thread
From: Gustavo A. R. Silva @ 2019-05-02 17:45 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Johan Hovold; +Cc: linux-usb



On 5/2/19 12:35 PM, Greg Kroah-Hartman wrote:
> Gustavo has been working to fix up all of the switch statements that
> "fall through" such that we can eventually turn on
> -Wimplicit-fallthrough.  As part of that, the io_edgeport.c driver is a
> bit "messy" with the parsing logic of a data packet.  Clean that logic
> up a bit by unindenting one level of the logic, and properly label
> /* Fall through */ to make gcc happy.
> 
> Reported-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> 

Acked-by: Gustavo A. R. Silva <gustavo@embeddedor.com>


Thanks, Greg.
--
Gustavo

> diff --git a/drivers/usb/serial/io_edgeport.c b/drivers/usb/serial/io_edgeport.c
> index 4ca31c0e4174..48a439298a68 100644
> --- a/drivers/usb/serial/io_edgeport.c
> +++ b/drivers/usb/serial/io_edgeport.c
> @@ -1751,7 +1751,7 @@ static void process_rcvd_data(struct edgeport_serial *edge_serial,
>  				edge_serial->rxState = EXPECT_HDR2;
>  				break;
>  			}
> -			/* otherwise, drop on through */
> +			/* Fall through */
>  		case EXPECT_HDR2:
>  			edge_serial->rxHeader2 = *buffer;
>  			++buffer;
> @@ -1790,29 +1790,20 @@ static void process_rcvd_data(struct edgeport_serial *edge_serial,
>  						edge_serial->rxHeader2, 0);
>  				edge_serial->rxState = EXPECT_HDR1;
>  				break;
> -			} else {
> -				edge_serial->rxPort =
> -				    IOSP_GET_HDR_PORT(edge_serial->rxHeader1);
> -				edge_serial->rxBytesRemaining =
> -				    IOSP_GET_HDR_DATA_LEN(
> -						edge_serial->rxHeader1,
> -						edge_serial->rxHeader2);
> -				dev_dbg(dev, "%s - Data for Port %u Len %u\n",
> -					__func__,
> -					edge_serial->rxPort,
> -					edge_serial->rxBytesRemaining);
> -
> -				/* ASSERT(DevExt->RxPort < DevExt->NumPorts);
> -				 * ASSERT(DevExt->RxBytesRemaining <
> -				 *		IOSP_MAX_DATA_LENGTH);
> -				 */
> -
> -				if (bufferLength == 0) {
> -					edge_serial->rxState = EXPECT_DATA;
> -					break;
> -				}
> -				/* Else, drop through */
>  			}
> +
> +			edge_serial->rxPort = IOSP_GET_HDR_PORT(edge_serial->rxHeader1);
> +			edge_serial->rxBytesRemaining = IOSP_GET_HDR_DATA_LEN(edge_serial->rxHeader1,
> +									      edge_serial->rxHeader2);
> +			dev_dbg(dev, "%s - Data for Port %u Len %u\n", __func__,
> +				edge_serial->rxPort,
> +				edge_serial->rxBytesRemaining);
> +
> +			if (bufferLength == 0) {
> +				edge_serial->rxState = EXPECT_DATA;
> +				break;
> +			}
> +			/* Fall through */
>  		case EXPECT_DATA: /* Expect data */
>  			if (bufferLength < edge_serial->rxBytesRemaining) {
>  				rxLen = bufferLength;
> 

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

* USB: serial: io_edgeport: fix up switch fall-through comments
@ 2019-05-03  6:09 ` Johan Hovold
  0 siblings, 0 replies; 10+ messages in thread
From: Johan Hovold @ 2019-05-03  6:09 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: Johan Hovold, linux-usb, Gustavo A. R. Silva

On Thu, May 02, 2019 at 07:35:15PM +0200, Greg Kroah-Hartman wrote:
> Gustavo has been working to fix up all of the switch statements that
> "fall through" such that we can eventually turn on
> -Wimplicit-fallthrough.  As part of that, the io_edgeport.c driver is a
> bit "messy" with the parsing logic of a data packet.  Clean that logic
> up a bit by unindenting one level of the logic, and properly label
> /* Fall through */ to make gcc happy.
> 
> Reported-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Now applied, thanks.

Gustavo, how many of these warnings are there left in the kernel now
that the last one in USB is gone? :)

Johan

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

* Re: [PATCH] USB: serial: io_edgeport: fix up switch fall-through comments
@ 2019-05-03  6:09 ` Johan Hovold
  0 siblings, 0 replies; 10+ messages in thread
From: Johan Hovold @ 2019-05-03  6:09 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: Johan Hovold, linux-usb, Gustavo A. R. Silva

On Thu, May 02, 2019 at 07:35:15PM +0200, Greg Kroah-Hartman wrote:
> Gustavo has been working to fix up all of the switch statements that
> "fall through" such that we can eventually turn on
> -Wimplicit-fallthrough.  As part of that, the io_edgeport.c driver is a
> bit "messy" with the parsing logic of a data packet.  Clean that logic
> up a bit by unindenting one level of the logic, and properly label
> /* Fall through */ to make gcc happy.
> 
> Reported-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Now applied, thanks.

Gustavo, how many of these warnings are there left in the kernel now
that the last one in USB is gone? :)

Johan

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

* USB: serial: io_edgeport: fix up switch fall-through comments
@ 2019-05-03 14:00 ` Gustavo A. R. Silva
  0 siblings, 0 replies; 10+ messages in thread
From: Gustavo A. R. Silva @ 2019-05-03 14:00 UTC (permalink / raw)
  To: Johan Hovold, Greg Kroah-Hartman; +Cc: linux-usb

On 5/3/19 1:09 AM, Johan Hovold wrote:
> On Thu, May 02, 2019 at 07:35:15PM +0200, Greg Kroah-Hartman wrote:
>> Gustavo has been working to fix up all of the switch statements that
>> "fall through" such that we can eventually turn on
>> -Wimplicit-fallthrough.  As part of that, the io_edgeport.c driver is a
>> bit "messy" with the parsing logic of a data packet.  Clean that logic
>> up a bit by unindenting one level of the logic, and properly label
>> /* Fall through */ to make gcc happy.
>>
>> Reported-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
>> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> 
> Now applied, thanks.
> 
> Gustavo, how many of these warnings are there left in the kernel now
> that the last one in USB is gone? :)
> 

Today, we woke up with 37 of these warnings left in linux-next. :)

There were more than 2000 when I first started auditing them.

Thanks
---
Gustavo

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

* Re: [PATCH] USB: serial: io_edgeport: fix up switch fall-through comments
@ 2019-05-03 14:00 ` Gustavo A. R. Silva
  0 siblings, 0 replies; 10+ messages in thread
From: Gustavo A. R. Silva @ 2019-05-03 14:00 UTC (permalink / raw)
  To: Johan Hovold, Greg Kroah-Hartman; +Cc: linux-usb



On 5/3/19 1:09 AM, Johan Hovold wrote:
> On Thu, May 02, 2019 at 07:35:15PM +0200, Greg Kroah-Hartman wrote:
>> Gustavo has been working to fix up all of the switch statements that
>> "fall through" such that we can eventually turn on
>> -Wimplicit-fallthrough.  As part of that, the io_edgeport.c driver is a
>> bit "messy" with the parsing logic of a data packet.  Clean that logic
>> up a bit by unindenting one level of the logic, and properly label
>> /* Fall through */ to make gcc happy.
>>
>> Reported-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
>> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> 
> Now applied, thanks.
> 
> Gustavo, how many of these warnings are there left in the kernel now
> that the last one in USB is gone? :)
> 

Today, we woke up with 37 of these warnings left in linux-next. :)

There were more than 2000 when I first started auditing them.

Thanks
--
Gustavo

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

* USB: serial: io_edgeport: fix up switch fall-through comments
@ 2019-05-03 15:46 ` Johan Hovold
  0 siblings, 0 replies; 10+ messages in thread
From: Johan Hovold @ 2019-05-03 15:46 UTC (permalink / raw)
  To: Gustavo A. R. Silva; +Cc: Johan Hovold, Greg Kroah-Hartman, linux-usb

On Fri, May 03, 2019 at 09:00:44AM -0500, Gustavo A. R. Silva wrote:
> On 5/3/19 1:09 AM, Johan Hovold wrote:

> > Gustavo, how many of these warnings are there left in the kernel now
> > that the last one in USB is gone? :)
> > 
> 
> Today, we woke up with 37 of these warnings left in linux-next. :)
> 
> There were more than 2000 when I first started auditing them.

Nice work! Hope the remaining ones aren't all super tricky to address.

Johan

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

* Re: [PATCH] USB: serial: io_edgeport: fix up switch fall-through comments
@ 2019-05-03 15:46 ` Johan Hovold
  0 siblings, 0 replies; 10+ messages in thread
From: Johan Hovold @ 2019-05-03 15:46 UTC (permalink / raw)
  To: Gustavo A. R. Silva; +Cc: Johan Hovold, Greg Kroah-Hartman, linux-usb

On Fri, May 03, 2019 at 09:00:44AM -0500, Gustavo A. R. Silva wrote:
> On 5/3/19 1:09 AM, Johan Hovold wrote:

> > Gustavo, how many of these warnings are there left in the kernel now
> > that the last one in USB is gone? :)
> > 
> 
> Today, we woke up with 37 of these warnings left in linux-next. :)
> 
> There were more than 2000 when I first started auditing them.

Nice work! Hope the remaining ones aren't all super tricky to address.

Johan

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

end of thread, other threads:[~2019-05-03 15:46 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-03  6:09 USB: serial: io_edgeport: fix up switch fall-through comments Johan Hovold
2019-05-03  6:09 ` [PATCH] " Johan Hovold
  -- strict thread matches above, loose matches on Subject: below --
2019-05-03 15:46 Johan Hovold
2019-05-03 15:46 ` [PATCH] " Johan Hovold
2019-05-03 14:00 Gustavo A. R. Silva
2019-05-03 14:00 ` [PATCH] " Gustavo A. R. Silva
2019-05-02 17:45 Gustavo A. R. Silva
2019-05-02 17:45 ` [PATCH] " Gustavo A. R. Silva
2019-05-02 17:35 Greg Kroah-Hartman
2019-05-02 17:35 ` [PATCH] " Greg Kroah-Hartman

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.