linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH linux-next] ARM/dma-mapping: replace kzalloc() and vzalloc() with kvzalloc()
@ 2023-12-12  3:20 yang.guang5
  2023-12-13  8:26 ` Linus Walleij
  0 siblings, 1 reply; 5+ messages in thread
From: yang.guang5 @ 2023-12-12  3:20 UTC (permalink / raw)
  To: linux
  Cc: jiang.xuexin, chen.haonan2, cgel.zte, rmk+kernel, willy,
	linus.walleij, rppt, jroedel, arnd, gregkh, jgg, linux-arm-kernel,
	linux-kernel

From: Yang Guang <yang.guang5@zte.com.cn>
using kvzalloc() simplifies the code by avoiding the 
use of different memory allocation functions for different 
situations, making the code more uniform and readable.

Signed-off-by: Chen Haonan <chen.haonan2@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 5409225b4abc..d688eac6dbc1 100644
--- a/arch/arm/mm/dma-mapping.c
+++ b/arch/arm/mm/dma-mapping.c
@@ -859,10 +859,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

_______________________________________________
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] 5+ messages in thread

end of thread, other threads:[~2023-12-14 17:11 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-12-12  3:20 [PATCH linux-next] ARM/dma-mapping: replace kzalloc() and vzalloc() with kvzalloc() yang.guang5
2023-12-13  8:26 ` Linus Walleij
2023-12-13 14:39   ` chenguanxi11234
2023-12-14 13:17     ` Linus Walleij
2023-12-14 17:10       ` Russell King (Oracle)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).