[PATCH] riscv: mm: Use better bitmap_zalloc()

Kefeng Wang wangkefeng.wang at huawei.com
Sat May 29 04:15:34 PDT 2021


Use better bitmap_zalloc() to allocate bitmap.

Cc: Palmer Dabbelt <palmerdabbelt at google.com>
Cc: Paul Walmsley <paul.walmsley at sifive.com>
Cc: Palmer Dabbelt <palmer at dabbelt.com>
Cc: linux-riscv at lists.infradead.org
Signed-off-by: Kefeng Wang <wangkefeng.wang at huawei.com>
---
 arch/riscv/mm/context.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/arch/riscv/mm/context.c b/arch/riscv/mm/context.c
index 83e7ae37675a..2aba0a6343d9 100644
--- a/arch/riscv/mm/context.c
+++ b/arch/riscv/mm/context.c
@@ -243,8 +243,7 @@ static int asids_init(void)
 	if (num_asids > (2 * num_possible_cpus())) {
 		atomic_long_set(&current_version, num_asids);
 
-		context_asid_map = kcalloc(BITS_TO_LONGS(num_asids),
-				   sizeof(*context_asid_map), GFP_KERNEL);
+		context_asid_map = bitmap_zalloc(num_asids, GFP_KERNEL);
 		if (!context_asid_map)
 			panic("Failed to allocate bitmap for %lu ASIDs\n",
 			      num_asids);
-- 
2.26.2




More information about the linux-riscv mailing list