diff options
| author | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-05-02 13:35:15 -0400 |
|---|---|---|
| committer | Johan Hovold <johan@kernel.org> | 2019-05-03 02:01:11 -0400 |
| commit | deb55e40ced4109c53d92af1bc07e1e998979792 (patch) | |
| tree | 15bc29237c54cc96ab4669d596e24cd70ff1f55b | |
| parent | 80ed53707bb3ec92c331ca33f45c113338ee434d (diff) | |
USB: serial: io_edgeport: fix up switch fall-through comments
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>
Signed-off-by: Johan Hovold <johan@kernel.org>
| -rw-r--r-- | drivers/usb/serial/io_edgeport.c | 37 |
1 files changed, 14 insertions, 23 deletions
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, | |||
| 1751 | edge_serial->rxState = EXPECT_HDR2; | 1751 | edge_serial->rxState = EXPECT_HDR2; |
| 1752 | break; | 1752 | break; |
| 1753 | } | 1753 | } |
| 1754 | /* otherwise, drop on through */ | 1754 | /* Fall through */ |
| 1755 | case EXPECT_HDR2: | 1755 | case EXPECT_HDR2: |
| 1756 | edge_serial->rxHeader2 = *buffer; | 1756 | edge_serial->rxHeader2 = *buffer; |
| 1757 | ++buffer; | 1757 | ++buffer; |
| @@ -1790,29 +1790,20 @@ static void process_rcvd_data(struct edgeport_serial *edge_serial, | |||
| 1790 | edge_serial->rxHeader2, 0); | 1790 | edge_serial->rxHeader2, 0); |
| 1791 | edge_serial->rxState = EXPECT_HDR1; | 1791 | edge_serial->rxState = EXPECT_HDR1; |
| 1792 | break; | 1792 | break; |
| 1793 | } else { | ||
| 1794 | edge_serial->rxPort = | ||
| 1795 | IOSP_GET_HDR_PORT(edge_serial->rxHeader1); | ||
| 1796 | edge_serial->rxBytesRemaining = | ||
| 1797 | IOSP_GET_HDR_DATA_LEN( | ||
| 1798 | edge_serial->rxHeader1, | ||
| 1799 | edge_serial->rxHeader2); | ||
| 1800 | dev_dbg(dev, "%s - Data for Port %u Len %u\n", | ||
| 1801 | __func__, | ||
| 1802 | edge_serial->rxPort, | ||
| 1803 | edge_serial->rxBytesRemaining); | ||
| 1804 | |||
| 1805 | /* ASSERT(DevExt->RxPort < DevExt->NumPorts); | ||
| 1806 | * ASSERT(DevExt->RxBytesRemaining < | ||
| 1807 | * IOSP_MAX_DATA_LENGTH); | ||
| 1808 | */ | ||
| 1809 | |||
| 1810 | if (bufferLength == 0) { | ||
| 1811 | edge_serial->rxState = EXPECT_DATA; | ||
| 1812 | break; | ||
| 1813 | } | ||
| 1814 | /* Else, drop through */ | ||
| 1815 | } | 1793 | } |
| 1794 | |||
| 1795 | edge_serial->rxPort = IOSP_GET_HDR_PORT(edge_serial->rxHeader1); | ||
| 1796 | edge_serial->rxBytesRemaining = IOSP_GET_HDR_DATA_LEN(edge_serial->rxHeader1, | ||
| 1797 | edge_serial->rxHeader2); | ||
| 1798 | dev_dbg(dev, "%s - Data for Port %u Len %u\n", __func__, | ||
| 1799 | edge_serial->rxPort, | ||
| 1800 | edge_serial->rxBytesRemaining); | ||
| 1801 | |||
| 1802 | if (bufferLength == 0) { | ||
| 1803 | edge_serial->rxState = EXPECT_DATA; | ||
| 1804 | break; | ||
| 1805 | } | ||
| 1806 | /* Fall through */ | ||
| 1816 | case EXPECT_DATA: /* Expect data */ | 1807 | case EXPECT_DATA: /* Expect data */ |
| 1817 | if (bufferLength < edge_serial->rxBytesRemaining) { | 1808 | if (bufferLength < edge_serial->rxBytesRemaining) { |
| 1818 | rxLen = bufferLength; | 1809 | rxLen = bufferLength; |
