From: Ross Lagerwall <ross.lagerwall@citrix.com>
Date: Mon, 11 Sep 2023 11:32:51 +0100
Subject: swiotlb: use the calculated number of areas
Git-commit: a6a241764f69c62d23fc6960920cc662ae4069e9
Patch-mainline: v6.6-rc4
References: git-fixes

Commit 8ac04063354a ("swiotlb: reduce the number of areas to match
actual memory pool size") calculated the reduced number of areas in
swiotlb_init_remap() but didn't actually use the value. Replace usage of
default_nareas accordingly.

Fixes: 8ac04063354a ("swiotlb: reduce the number of areas to match actual memory pool size")
Signed-off-by: Ross Lagerwall <ross.lagerwall@citrix.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Acked-by: Joerg Roedel <jroedel@suse.de>
---
 kernel/dma/swiotlb.c |    5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

--- a/kernel/dma/swiotlb.c
+++ b/kernel/dma/swiotlb.c
@@ -357,14 +357,13 @@ void __init swiotlb_init_remap(bool addr
 	}
 
 	mem->areas = memblock_alloc(array_size(sizeof(struct io_tlb_area),
-		default_nareas), SMP_CACHE_BYTES);
+		nareas), SMP_CACHE_BYTES);
 	if (!mem->areas) {
 		pr_warn("%s: Failed to allocate mem->areas.\n", __func__);
 		return;
 	}
 
-	swiotlb_init_io_tlb_mem(mem, __pa(tlb), nslabs, flags, false,
-				default_nareas);
+	swiotlb_init_io_tlb_mem(mem, __pa(tlb), nslabs, flags, false, nareas);
 
 	if (flags & SWIOTLB_VERBOSE)
 		swiotlb_print_info();
