From patchwork Tue Dec 12 03:20:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: yang.guang5@zte.com.cn X-Patchwork-Id: 13488458 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C2769C4167B for ; Tue, 12 Dec 2023 03:21:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Subject:Cc:To:From:Mime-Version: Message-ID:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=QX80qNIkLXcai8ZHkcOj25rDKbiIO+5oLZqbs7L/s/Y=; b=3wa qiC6GrM82KtxvzXr5knxIe952P/32UmcWll/jA4CmDIMbXt5DnPfsxFLudCN5qXvxVfumT9LOGVWu v8eWc71zKtHWfmz8S0xtRhQr18+piYEjYRicm6qNL+7AhpbuHAgszsUx/rgGWmzotbQfv4Vkx/1Ow nHAaLNCABuvnLsb3cfrh1Y88S2QN/9p3ZJZSzXS0bGV6uBK0OyU9Mlgu4/Gbw1Zi/N/So4zmXtRiv 523IInsPNLJWYLWwPo3s8bmn1NYEhRi/RQ1WixPfgm7yVZ6aG4kk0H8a9RgcUTappVoa7//zVOtla Kmfrs4eOsGT4P77mVL2WOyKmejb2X1w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rCtKF-00AcfP-22; Tue, 12 Dec 2023 03:20:51 +0000 Received: from mxhk.zte.com.cn ([63.216.63.40]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rCtKC-00Acda-2D for linux-arm-kernel@lists.infradead.org; Tue, 12 Dec 2023 03:20:50 +0000 Received: from mse-fl1.zte.com.cn (unknown [10.5.228.132]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mxhk.zte.com.cn (FangMail) with ESMTPS id 4Sq3lq4nkdz8XrRF; Tue, 12 Dec 2023 11:20:39 +0800 (CST) Received: from xaxapp03.zte.com.cn ([10.88.97.17]) by mse-fl1.zte.com.cn with SMTP id 3BC3KXj1052334; Tue, 12 Dec 2023 11:20:33 +0800 (+08) (envelope-from yang.guang5@zte.com.cn) Received: from mapi (xaxapp03[null]) by mapi (Zmail) with MAPI id mid31; Tue, 12 Dec 2023 11:20:34 +0800 (CST) Date: Tue, 12 Dec 2023 11:20:34 +0800 (CST) X-Zmail-TransId: 2afb6577d182ffffffff9f1-650fe X-Mailer: Zmail v1.0 Message-ID: <202312121120348064534@zte.com.cn> Mime-Version: 1.0 From: To: Cc: , , , , , , , , , , , , Subject: =?utf-8?q?=5BPATCH_linux-next=5D_ARM/dma-mapping=3A_replace_kzalloc?= =?utf-8?q?=28=29_and_vzalloc=28=29_with_kvzalloc=28=29?= X-MAIL: mse-fl1.zte.com.cn 3BC3KXj1052334 X-Fangmail-Gw-Spam-Type: 0 X-Fangmail-Anti-Spam-Filtered: true X-Fangmail-MID-QID: 6577D187.000/4Sq3lq4nkdz8XrRF X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231211_192048_878849_FB6F29DA X-CRM114-Status: GOOD ( 10.68 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Yang Guang 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 Reviewed-by: Linus Walleij --- 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;