All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mathias Nyman <mathias.nyman@linux.intel.com>
To: <gregkh@linuxfoundation.org>
Cc: <linux-usb@vger.kernel.org>,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	Mathias Nyman <mathias.nyman@linux.intel.com>
Subject: [PATCH 05/14] xhci: mem: Use while (i--) pattern to clean up
Date: Fri, 17 Mar 2023 17:47:06 +0200	[thread overview]
Message-ID: <20230317154715.535523-6-mathias.nyman@linux.intel.com> (raw)
In-Reply-To: <20230317154715.535523-1-mathias.nyman@linux.intel.com>

From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

Use more natural while (i--) patter to clean up allocated resources.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
---
 drivers/usb/host/xhci-mem.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c
index fa0c4ac2ca7f..b8c1465f8d23 100644
--- a/drivers/usb/host/xhci-mem.c
+++ b/drivers/usb/host/xhci-mem.c
@@ -1679,11 +1679,10 @@ static int scratchpad_alloc(struct xhci_hcd *xhci, gfp_t flags)
 	return 0;
 
  fail_sp4:
-	for (i = i - 1; i >= 0; i--) {
+	while (i--)
 		dma_free_coherent(dev, xhci->page_size,
 				    xhci->scratchpad->sp_buffers[i],
 				    xhci->scratchpad->sp_array[i]);
-	}
 
 	kfree(xhci->scratchpad->sp_buffers);
 
-- 
2.25.1


  parent reply	other threads:[~2023-03-17 15:46 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-17 15:47 [PATCH 00/14] xhci features for usb-next Mathias Nyman
2023-03-17 15:47 ` [PATCH 01/14] xhci: mem: Carefully calculate size for memory allocations Mathias Nyman
2023-03-17 15:47 ` [PATCH 02/14] xhci: mem: Use dma_poll_zalloc() instead of explicit memset() Mathias Nyman
2023-03-17 15:47 ` [PATCH 03/14] xhci: mem: Get rid of redundant 'else' Mathias Nyman
2023-03-17 15:47 ` [PATCH 04/14] xhci: mem: Drop useless return:s Mathias Nyman
2023-03-17 15:47 ` Mathias Nyman [this message]
2023-03-17 15:47 ` [PATCH 06/14] xhci: mem: Replace explicit castings with appropriate specifiers Mathias Nyman
2023-03-17 15:47 ` [PATCH 07/14] xhci: mem: Join string literals back Mathias Nyman
2023-03-17 15:47 ` [PATCH 08/14] xhci: dbc: Provide sysfs option to configure dbc descriptors Mathias Nyman
2023-03-17 15:47 ` [PATCH 09/14] xhci: Avoid PCI MSI/MSIX interrupt reinitialization at resume Mathias Nyman
2023-03-17 15:47 ` [PATCH 10/14] xhci: Move functions to setup msi to xhci-pci Mathias Nyman
2023-03-17 15:47 ` [PATCH 11/14] xhci: move PCI specific MSI/MSIX cleanup away from generic xhci functions Mathias Nyman
2023-03-17 15:47 ` [PATCH 12/14] xhci: Move functions to cleanup MSI to xhci-pci Mathias Nyman
2023-03-17 15:47 ` [PATCH 13/14] xhci: Call MSI sync function from xhci-pci instead of generic xhci code Mathias Nyman
2023-03-17 15:47 ` [PATCH 14/14] xhci: Move xhci MSI sync function to to xhci-pci Mathias Nyman
2023-03-17 15:53 ` [PATCH 00/14] xhci features for usb-next Mathias Nyman

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=20230317154715.535523-6-mathias.nyman@linux.intel.com \
    --to=mathias.nyman@linux.intel.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-usb@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.