mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>,
	linux-nfc@lists.01.org, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] nfc: mrvl: remove useless "continue" at end of loop
Date: Tue, 01 Jun 2021 09:30:29 -0700	[thread overview]
Message-ID: <5780056e09dbbd285d470a313939e5d3cc1a0c3e.camel@perches.com> (raw)
In-Reply-To: <20210601160713.312622-1-krzysztof.kozlowski@canonical.com>

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)



  reply	other threads:[~2021-06-01 16:30 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-01 16:07 Krzysztof Kozlowski
2021-06-01 16:30 ` Joe Perches [this message]
2021-06-01 16:38   ` [PATCH] MAINTAINERS: nfc mailing lists are subscribers-only Joe Perches
2021-06-02  0:20     ` patchwork-bot+netdevbpf
2021-06-02 11:10   ` [PATCH] nfc: mrvl: remove useless "continue" at end of loop Krzysztof Kozlowski

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=5780056e09dbbd285d470a313939e5d3cc1a0c3e.camel@perches.com \
    --to=joe@perches.com \
    --cc=krzysztof.kozlowski@canonical.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nfc@lists.01.org \
    --cc=netdev@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®