lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <5780056e09dbbd285d470a313939e5d3cc1a0c3e.camel@perches.com>
Date:   Tue, 01 Jun 2021 09:30:29 -0700
From:   Joe Perches <joe@...ches.com>
To:     Krzysztof Kozlowski <krzysztof.kozlowski@...onical.com>,
        linux-nfc@...ts.01.org, netdev@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH] nfc: mrvl: remove useless "continue" at end of loop

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)


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ