All of lore.kernel.org
 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; 2+ messages 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 related	[flat|nested] 2+ messages in thread

* [PATCH] arm: mm: use kvmalloc instead of kzalloc and vzalloc
@ 2021-12-14 12:17 ` Qing Wang
  0 siblings, 0 replies; 2+ messages 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


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-12-14 12:29 UTC | newest]

Thread overview: 2+ messages (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
2021-12-14 12:17 ` Qing Wang

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.