Skip to contentSkip to conversation

arm: mm: use kvmalloc instead of kzalloc and vzalloc

PATCH New Qing Wang 1 participant 1 message Dec 14, 2021 Arm (32-bit)

lore
Share & tools
lore

Qing Wang

author
#0 lore raw

PATCH 1/1 arm: mm: use kvmalloc instead of kzalloc and vzalloc

From: Wang Qing <[email protected]>

fix kvmalloc.cocci warning:
arch/arm/mm/dma-mapping.c:1209:28-29: WARNING opportunity for kvmalloc

---
 arch/arm/mm/dma-mapping.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
arch/arm/mm/dma-mapping.c +1 -4
index 4b61541..0fa8801
@@ -1206,10 +1206,7 @@ static struct page **__iommu_alloc_buffer(struct device *dev, size_t size,
 	int i = 0;
 	int order_idx = 0;
 
-	if (array_size <= PAGE_SIZE)
-		pages = kzalloc(array_size, GFP_KERNEL);
-	else
-		pages = vzalloc(array_size);
+	pages = kvmalloc(array_size, GFP_KERNEL);
 	if (!pages)
 		return NULL;
 
Signature · 1 line
2.7.4