Skip to content

Commit a00e9e4

Browse files
tititiou36Marc Zyngier
authored andcommitted
KVM: arm64: Use the bitmap API to allocate bitmaps
Use bitmap_zalloc()/bitmap_free() instead of hand-writing them. It is less verbose and it improves the semantic. Signed-off-by: Christophe JAILLET <[email protected]> Signed-off-by: Marc Zyngier <[email protected]> Link: https://lore.kernel.org/r/3c5043731db4d3635383e9326bc7e98e25de3288.1681854412.git.christophe.jaillet@wanadoo.fr
1 parent 4be8ddb commit a00e9e4

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

arch/arm64/kvm/vmid.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -182,8 +182,7 @@ int __init kvm_arm_vmid_alloc_init(void)
182182
*/
183183
WARN_ON(NUM_USER_VMIDS - 1 <= num_possible_cpus());
184184
atomic64_set(&vmid_generation, VMID_FIRST_VERSION);
185-
vmid_map = kcalloc(BITS_TO_LONGS(NUM_USER_VMIDS),
186-
sizeof(*vmid_map), GFP_KERNEL);
185+
vmid_map = bitmap_zalloc(NUM_USER_VMIDS, GFP_KERNEL);
187186
if (!vmid_map)
188187
return -ENOMEM;
189188

@@ -192,5 +191,5 @@ int __init kvm_arm_vmid_alloc_init(void)
192191

193192
void __init kvm_arm_vmid_alloc_free(void)
194193
{
195-
kfree(vmid_map);
194+
bitmap_free(vmid_map);
196195
}

0 commit comments

Comments
 (0)