public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Mathias Nyman <mathias.nyman@linux.intel.com>,
	linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Mathias Nyman <mathias.nyman@intel.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Subject: [PATCH v2 5/7] xhci: mem: Use while (i--) pattern to clean up
Date: Wed,  8 Feb 2023 17:11:27 +0200	[thread overview]
Message-ID: <20230208151129.28987-6-andriy.shevchenko@linux.intel.com> (raw)
In-Reply-To: <20230208151129.28987-1-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>
---
 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.39.1


  parent reply	other threads:[~2023-02-08 15:16 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-08 15:11 [PATCH v2 0/7] xhci: mem: Short cleanup series Andy Shevchenko
2023-02-08 15:11 ` [PATCH v2 1/7] xhci: mem: Carefully calculate size for memory allocations Andy Shevchenko
2023-02-08 15:11 ` [PATCH v2 2/7] xhci: mem: Use dma_poll_zalloc() instead of explicit memset() Andy Shevchenko
2023-02-08 15:11 ` [PATCH v2 3/7] xhci: mem: Get rid of redundant 'else' Andy Shevchenko
2023-02-08 15:11 ` [PATCH v2 4/7] xhci: mem: Drop useless return:s Andy Shevchenko
2023-02-08 15:11 ` Andy Shevchenko [this message]
2023-02-08 15:11 ` [PATCH v2 6/7] xhci: mem: Replace explicit castings with appropriate specifiers Andy Shevchenko
2023-02-08 15:11 ` [PATCH v2 7/7] xhci: mem: Join string literals back Andy Shevchenko
2023-02-10 14:31 ` [PATCH v2 0/7] xhci: mem: Short cleanup series 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=20230208151129.28987-6-andriy.shevchenko@linux.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=mathias.nyman@intel.com \
    --cc=mathias.nyman@linux.intel.com \
    /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