summaryrefslogtreecommitdiff
path: root/drivers/usb/host/xhci-mem.c
diff options
context:
space:
mode:
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>2023-03-17 18:47:06 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-03-23 19:25:22 +0300
commit76dc910af13c677b504ac8606352c791891166b1 (patch)
tree9c5bc1fc15d879577d9fed2c650e4a353652ff3d /drivers/usb/host/xhci-mem.c
parent3056a5cafa3cf83c7c83d3fb4029707888d4bb63 (diff)
downloadlinux-76dc910af13c677b504ac8606352c791891166b1.tar.xz
xhci: mem: Use while (i--) pattern to clean up
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>
Diffstat (limited to 'drivers/usb/host/xhci-mem.c')
-rw-r--r--drivers/usb/host/xhci-mem.c3
1 files changed, 1 insertions, 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);