public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: <yang.guang5@zte.com.cn>
To: <linux@armlinux.org.uk>
Cc: <jiang.xuexin@zte.com.cn>, <chen.haonan2@zte.com.cn>,
	<cgel.zte@gmail.com>, <rmk+kernel@armlinux.org.uk>,
	<willy@infradead.org>, <linus.walleij@linaro.org>,
	<rppt@kernel.org>, <jroedel@suse.de>, <arnd@arndb.de>,
	<gregkh@linuxfoundation.org>, <jgg@ziepe.ca>,
	<linux-arm-kernel@lists.infradead.org>,
	<linux-kernel@vger.kernel.org>
Subject: [PATCH linux-next] ARM/dma-mapping: replace kzalloc() and vzalloc() with kvzalloc()
Date: Tue, 12 Dec 2023 11:20:34 +0800 (CST)	[thread overview]
Message-ID: <202312121120348064534@zte.com.cn> (raw)

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

             reply	other threads:[~2023-12-12  3:21 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-12  3:20 yang.guang5 [this message]
2023-12-13  8:26 ` [PATCH linux-next] ARM/dma-mapping: replace kzalloc() and vzalloc() with kvzalloc() Linus Walleij
2023-12-13 14:39   ` chenguanxi11234
2023-12-14 13:17     ` Linus Walleij
2023-12-14 17:10       ` Russell King (Oracle)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202312121120348064534@zte.com.cn \
    --to=yang.guang5@zte.com.cn \
    --cc=arnd@arndb.de \
    --cc=cgel.zte@gmail.com \
    --cc=chen.haonan2@zte.com.cn \
    --cc=gregkh@linuxfoundation.org \
    --cc=jgg@ziepe.ca \
    --cc=jiang.xuexin@zte.com.cn \
    --cc=jroedel@suse.de \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=rmk+kernel@armlinux.org.uk \
    --cc=rppt@kernel.org \
    --cc=willy@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox