diff mbox series

[3/6] swiotlb: use wrap_area_index() instead of open-coding it

Message ID 20230712180141.713006-4-tim.gardner@canonical.com
State New
Headers show
Series Azure: CPU lockup in CVM instances | expand

Commit Message

Tim Gardner July 12, 2023, 6:01 p.m. UTC
From: Petr Tesarik <petr.tesarik.ext@huawei.com>

BugLink: https://bugs.launchpad.net/bugs/2026736

No functional change, just use an existing helper.

Signed-off-by: Petr Tesarik <petr.tesarik.ext@huawei.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
(cherry picked from commit 39e7d2ab6ea9fd6b389091ec223d566934fe7be5)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
---
 kernel/dma/swiotlb.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/kernel/dma/swiotlb.c b/kernel/dma/swiotlb.c
index 9e1f88cebb17..7d55c0fb2678 100644
--- a/kernel/dma/swiotlb.c
+++ b/kernel/dma/swiotlb.c
@@ -655,10 +655,7 @@  static int swiotlb_do_find_slots(struct device *dev, int area_index,
 	/*
 	 * Update the indices to avoid searching in the next round.
 	 */
-	if (index + nslots < mem->area_nslabs)
-		area->index = index + nslots;
-	else
-		area->index = 0;
+	area->index = wrap_area_index(mem, index + nslots);
 	area->used += nslots;
 	spin_unlock_irqrestore(&area->lock, flags);
 	return slot_index;