* [PATCH v2 1/2] nfc: mrvl: remove useless "continue" at end of loop @ 2021-06-02 11:20 Krzysztof Kozlowski 2021-06-02 11:20 ` [PATCH v2 2/2] nfc: mrvl: reduce the scope of local variables Krzysztof Kozlowski 2021-06-03 21:10 ` [PATCH v2 1/2] nfc: mrvl: remove useless "continue" at end of loop patchwork-bot+netdevbpf 0 siblings, 2 replies; 3+ messages in thread From: Krzysztof Kozlowski @ 2021-06-02 11:20 UTC (permalink / raw) To: Krzysztof Kozlowski, David S. Miller, linux-nfc, netdev, linux-kernel Cc: Joe Perches The "continue" statement at the end of a for loop does not have an effect. Entire loop contents can be slightly simplified to increase code readability. No functional change. Suggested-by: Joe Perches <joe@perches.com> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com> --- Changes since v1: 1. Make it if-else-if as Joe suggested. --- drivers/nfc/nfcmrvl/usb.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/nfc/nfcmrvl/usb.c b/drivers/nfc/nfcmrvl/usb.c index bcd563cb556c..6fec20abfd1e 100644 --- a/drivers/nfc/nfcmrvl/usb.c +++ b/drivers/nfc/nfcmrvl/usb.c @@ -319,13 +319,9 @@ static int nfcmrvl_probe(struct usb_interface *intf, if (!drv_data->bulk_tx_ep && 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; } } -- 2.27.0 ^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH v2 2/2] nfc: mrvl: reduce the scope of local variables 2021-06-02 11:20 [PATCH v2 1/2] nfc: mrvl: remove useless "continue" at end of loop Krzysztof Kozlowski @ 2021-06-02 11:20 ` Krzysztof Kozlowski 2021-06-03 21:10 ` [PATCH v2 1/2] nfc: mrvl: remove useless "continue" at end of loop patchwork-bot+netdevbpf 1 sibling, 0 replies; 3+ messages in thread From: Krzysztof Kozlowski @ 2021-06-02 11:20 UTC (permalink / raw) To: Krzysztof Kozlowski, David S. Miller, linux-nfc, netdev, linux-kernel Cc: Joe Perches In two places the 'ep_desc' and 'skb' local variables are used only within if() or for() block, so they scope can be reduced which makes the entire code slightly easier to follow. No functional change. Suggested-by: Joe Perches <joe@perches.com> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com> --- Changes since v1: 1. New patch --- drivers/nfc/nfcmrvl/usb.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/nfc/nfcmrvl/usb.c b/drivers/nfc/nfcmrvl/usb.c index 6fec20abfd1e..ec6fd7a3f31f 100644 --- a/drivers/nfc/nfcmrvl/usb.c +++ b/drivers/nfc/nfcmrvl/usb.c @@ -68,7 +68,6 @@ static int nfcmrvl_inc_tx(struct nfcmrvl_usb_drv_data *drv_data) static void nfcmrvl_bulk_complete(struct urb *urb) { struct nfcmrvl_usb_drv_data *drv_data = urb->context; - struct sk_buff *skb; int err; dev_dbg(&drv_data->udev->dev, "urb %p status %d count %d\n", @@ -78,6 +77,8 @@ static void nfcmrvl_bulk_complete(struct urb *urb) return; if (!urb->status) { + struct sk_buff *skb; + skb = nci_skb_alloc(drv_data->priv->ndev, urb->actual_length, GFP_ATOMIC); if (!skb) { @@ -296,7 +297,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,6 +314,8 @@ 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 && -- 2.27.0 ^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2 1/2] nfc: mrvl: remove useless "continue" at end of loop 2021-06-02 11:20 [PATCH v2 1/2] nfc: mrvl: remove useless "continue" at end of loop Krzysztof Kozlowski 2021-06-02 11:20 ` [PATCH v2 2/2] nfc: mrvl: reduce the scope of local variables Krzysztof Kozlowski @ 2021-06-03 21:10 ` patchwork-bot+netdevbpf 1 sibling, 0 replies; 3+ messages in thread From: patchwork-bot+netdevbpf @ 2021-06-03 21:10 UTC (permalink / raw) To: Krzysztof Kozlowski; +Cc: davem, linux-nfc, netdev, linux-kernel, joe Hello: This series was applied to netdev/net-next.git (refs/heads/master): On Wed, 2 Jun 2021 13:20:10 +0200 you wrote: > The "continue" statement at the end of a for loop does not have an > effect. Entire loop contents can be slightly simplified to increase > code readability. No functional change. > > Suggested-by: Joe Perches <joe@perches.com> > Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com> > > [...] Here is the summary with links: - [v2,1/2] nfc: mrvl: remove useless "continue" at end of loop https://git.kernel.org/netdev/net-next/c/a58224040f2d - [v2,2/2] nfc: mrvl: reduce the scope of local variables https://git.kernel.org/netdev/net-next/c/2c95e6c7e558 You are awesome, thank you! -- Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-06-03 21:10 UTC | newest] Thread overview: 3+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2021-06-02 11:20 [PATCH v2 1/2] nfc: mrvl: remove useless "continue" at end of loop Krzysztof Kozlowski 2021-06-02 11:20 ` [PATCH v2 2/2] nfc: mrvl: reduce the scope of local variables Krzysztof Kozlowski 2021-06-03 21:10 ` [PATCH v2 1/2] nfc: mrvl: remove useless "continue" at end of loop patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox