mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] arm: mm: use kvmalloc instead of kzalloc and vzalloc
@ 2021-12-14 12:17 Qing Wang
  0 siblings, 0 replies; only message in thread
From: Qing Wang @ 2021-12-14 12:17 UTC (permalink / raw)
  To: Russell King, linux-arm-kernel, linux-kernel; +Cc: Wang Qing

From: Wang Qing <wangqing@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@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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-12-14 12:17 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-14 12:17 [PATCH] arm: mm: use kvmalloc instead of kzalloc and vzalloc Qing Wang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®