Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp1168414ybk; Sat, 16 May 2020 03:11:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxdB9fZxrZfzZxiXj9x+lv/Rv98rY+jg/FZ5ej9qRzs2+bowkR//ARJfSlNQ+9OlYdTCn6i X-Received: by 2002:aa7:dc49:: with SMTP id g9mr6390074edu.167.1589623913834; Sat, 16 May 2020 03:11:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589623913; cv=none; d=google.com; s=arc-20160816; b=bIaguEKhlAydyTeRToZ5vOcaHecJnaAPjOh1aGcEOEljlQ1CCH9ZmujcX7Bbe81Dli svcoVhOlw2QPbqIns0Wtfh/OcD4KAYmi/milxLWTlK3/FqqkjJ2tfKTf0C/71MOqEpdT JNxXtFEiS1OgSA6CKR5mmpZTEBOt6GB4attQmCw5pID6EzJugedjuJmGFabi9fCrTd9S loPmCp09LgeJ+QecI4fZ6qWeF+yBXipw6cCQQr9dZClLvVAlYyzq/PLMoTKaz+UgJKeW Rrw7i8WcWVUr2VkywE4weu6VTWdHlRJbyaXQ4JAZPjaLt8N4JmKg05/BLtOeP7cK1S6U ZbLQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:mime-version:user-agent:date:message-id:subject :from:cc:to; bh=cS3o5WwQlbBRpA//Wsp45zsR5Wb9ncEoyeOHCHXfWP8=; b=Y/r405YJiUWQAkPkz09wr4ZfpO/2MRcPMj64u3cP9ue8w4QycDcKFwKc7n5lJkfEE6 dHxXhNV0smbgaHAkrhP/9tF0AFe8vTOU8voKGmKh+gno8yNM3iwqde1CZZ2JBpJSKAH9 GcZHmzV1Dtl9J7PLaVTKhlvCpfTBWFn3aee6QxTjuuesmBK9Qdy5DS4MjR/iV9N1bIXv NpzWWE5PNW4dbZOdMsXVo/VqugLZpf297lMU+FZCorH/N0aPt0fy4EglRFvSXvmNOXRV C7P2+KF2UOk+ZchhDEb2J3CmpRxTegTKZkMahZ8ZJ/EIX5VywoPg/Jr/bDQ7wsxBrRjq oDlw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c21si3102375edx.105.2020.05.16.03.11.29; Sat, 16 May 2020 03:11:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726188AbgEPKKA (ORCPT + 99 others); Sat, 16 May 2020 06:10:00 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:4852 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725792AbgEPKKA (ORCPT ); Sat, 16 May 2020 06:10:00 -0400 Received: from DGGEMS406-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 7DC1A5D1BEDB315367B0; Sat, 16 May 2020 18:09:49 +0800 (CST) Received: from [127.0.0.1] (10.166.215.237) by DGGEMS406-HUB.china.huawei.com (10.3.19.206) with Microsoft SMTP Server id 14.3.487.0; Sat, 16 May 2020 18:09:38 +0800 To: Christoph Hellwig , , , , CC: Shiyuan Hu , Hewenliang From: Yunfeng Ye Subject: [PATCH] dma-coherent: switch to bitmap_zalloc() in dma_init_coherent_memory() Message-ID: <1b02b07b-617e-bc5c-8619-7a46fba5a512@huawei.com> Date: Sat, 16 May 2020 18:09:38 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.166.215.237] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Switch to bitmap_zalloc() to show clearly in dma_init_coherent_memory(). No functional change. Signed-off-by: Yunfeng Ye --- kernel/dma/coherent.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/kernel/dma/coherent.c b/kernel/dma/coherent.c index 2a0c4985f38e..794b31e61ca0 100644 --- a/kernel/dma/coherent.c +++ b/kernel/dma/coherent.c @@ -44,7 +44,6 @@ static int dma_init_coherent_memory(phys_addr_t phys_addr, struct dma_coherent_mem *dma_mem = NULL; void *mem_base = NULL; int pages = size >> PAGE_SHIFT; - int bitmap_size = BITS_TO_LONGS(pages) * sizeof(long); int ret; if (!size) { @@ -62,7 +61,7 @@ static int dma_init_coherent_memory(phys_addr_t phys_addr, ret = -ENOMEM; goto out; } - dma_mem->bitmap = kzalloc(bitmap_size, GFP_KERNEL); + dma_mem->bitmap = bitmap_zalloc(pages, GFP_KERNEL); if (!dma_mem->bitmap) { ret = -ENOMEM; goto out; @@ -90,7 +89,7 @@ static void dma_release_coherent_memory(struct dma_coherent_mem *mem) return; memunmap(mem->virt_base); - kfree(mem->bitmap); + bitmap_free(mem->bitmap); kfree(mem); } -- 1.8.3.1