[PATCH] arm: mm: use kvmalloc instead of kzalloc and vzalloc
Qing Wang
wangqing at vivo.com
Tue Dec 14 04:17:22 PST 2021
From: Wang Qing <wangqing at vivo.com>
fix kvmalloc.cocci warning:
arch/arm/mm/dma-mapping.c:1209:28-29: WARNING opportunity for kvmalloc
Signed-off-by: Wang Qing <wangqing at vivo.com>
---
arch/arm/mm/dma-mapping.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c
index 4b61541..0fa8801
--- a/arch/arm/mm/dma-mapping.c
+++ b/arch/arm/mm/dma-mapping.c
@@ -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;
--
2.7.4
More information about the linux-arm-kernel
mailing list