Re: [PATCH] nfc: mrvl: remove useless "continue" at end of loop
From: Joe Perches
Date: Tue Jun 01 2021 - 12:30:43 EST
On Tue, 2021-06-01 at 18:07 +0200, Krzysztof Kozlowski wrote:
> The "continue" statement at the end of a for loop does not have an
> effect.
[]
> diff --git a/drivers/nfc/nfcmrvl/usb.c b/drivers/nfc/nfcmrvl/usb.c
[]
> @@ -325,7 +325,6 @@ static int nfcmrvl_probe(struct usb_interface *intf,
> if (!drv_data->bulk_rx_ep &&
> usb_endpoint_is_bulk_in(ep_desc)) {
> drv_data->bulk_rx_ep = ep_desc;
> - continue;
> }
> }
I think this code would be clearer with an if/else instead of
multiple continues.
---
drivers/nfc/nfcmrvl/usb.c | 14 +++++---------
1 file changed, 5 insertions(+), 9 deletions(-)
diff --git a/drivers/nfc/nfcmrvl/usb.c b/drivers/nfc/nfcmrvl/usb.c
index bcd563cb556ce..1616b873b15e6 100644
--- a/drivers/nfc/nfcmrvl/usb.c
+++ b/drivers/nfc/nfcmrvl/usb.c
@@ -296,7 +296,6 @@ static void nfcmrvl_waker(struct work_struct *work)
static int nfcmrvl_probe(struct usb_interface *intf,
const struct usb_device_id *id)
{
- struct usb_endpoint_descriptor *ep_desc;
struct nfcmrvl_usb_drv_data *drv_data;
struct nfcmrvl_private *priv;
int i;
@@ -314,19 +313,16 @@ static int nfcmrvl_probe(struct usb_interface *intf,
return -ENOMEM;
for (i = 0; i < intf->cur_altsetting->desc.bNumEndpoints; i++) {
+ struct usb_endpoint_descriptor *ep_desc;
+
ep_desc = &intf->cur_altsetting->endpoint[i].desc;
if (!drv_data->bulk_tx_ep &&
- usb_endpoint_is_bulk_out(ep_desc)) {
+ usb_endpoint_is_bulk_out(ep_desc))
drv_data->bulk_tx_ep = ep_desc;
- continue;
- }
-
- if (!drv_data->bulk_rx_ep &&
- usb_endpoint_is_bulk_in(ep_desc)) {
+ else if (!drv_data->bulk_rx_ep &&
+ usb_endpoint_is_bulk_in(ep_desc))
drv_data->bulk_rx_ep = ep_desc;
- continue;
- }
}
if (!drv_data->bulk_tx_ep || !drv_data->bulk_rx_ep)