]> www.infradead.org Git - users/willy/linux.git/commitdiff
xhci: mem: Use while (i--) pattern to clean up
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Fri, 17 Mar 2023 15:47:06 +0000 (17:47 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 23 Mar 2023 16:25:22 +0000 (17:25 +0100)
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>
Link: https://lore.kernel.org/r/20230317154715.535523-6-mathias.nyman@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/host/xhci-mem.c

index fa0c4ac2ca7fd3b410e5118fe4616568cfa042f5..b8c1465f8d23eab6eb5f9026fbee26efd39b7f65 100644 (file)
@@ -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);