[PATCH] ARM: dma-mapping: Use kvzalloc in __iommu_alloc_buffer
cgel.zte at gmail.com
cgel.zte at gmail.com
Wed Jun 15 00:41:46 PDT 2022
From: Minghao Chi <chi.minghao at zte.com.cn>
Use kvzalloc() in __iommu_alloc_buffer() instead of open-coding it.
Reported-by: Zeal Robot <zealci at zte.com.cn>
Signed-off-by: Minghao Chi <chi.minghao at zte.com.cn>
---
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 82ffac621854..940819eda182 100644
--- a/arch/arm/mm/dma-mapping.c
+++ b/arch/arm/mm/dma-mapping.c
@@ -1208,10 +1208,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 = kvzalloc(array_size, GFP_KERNEL);
if (!pages)
return NULL;
--
2.25.1
More information about the linux-arm-kernel
mailing list