diff options
author | Christophe JAILLET <christophe.jaillet@wanadoo.fr> | 2022-07-09 17:56:43 +0200 |
---|---|---|
committer | Michael Ellerman <mpe@ellerman.id.au> | 2022-11-24 11:57:50 +0100 |
commit | a96b20758b23be7e9f693218908228d6100c3c26 (patch) | |
tree | a1e55e0311b4f32a39b5fd7f40e00b4dfe8b4b34 /arch/powerpc/kvm | |
parent | KVM: PPC: Book3s: Use arg->size directly in kvm_vm_ioctl_create_spapr_tce() (diff) | |
download | linux-a96b20758b23be7e9f693218908228d6100c3c26.tar.xz linux-a96b20758b23be7e9f693218908228d6100c3c26.zip |
KVM: PPC: Book3S HV: 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 <christophe.jaillet@wanadoo.fr>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/52e843a460bc374973149b8da0bd04f9761b80b7.1657382184.git.christophe.jaillet@wanadoo.fr
Diffstat (limited to 'arch/powerpc/kvm')
-rw-r--r-- | arch/powerpc/kvm/book3s_hv_uvmem.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/arch/powerpc/kvm/book3s_hv_uvmem.c b/arch/powerpc/kvm/book3s_hv_uvmem.c index e2f11f9c3f2a..1d67baa5557a 100644 --- a/arch/powerpc/kvm/book3s_hv_uvmem.c +++ b/arch/powerpc/kvm/book3s_hv_uvmem.c @@ -1190,8 +1190,7 @@ int kvmppc_uvmem_init(void) pfn_first = res->start >> PAGE_SHIFT; pfn_last = pfn_first + (resource_size(res) >> PAGE_SHIFT); - kvmppc_uvmem_bitmap = kcalloc(BITS_TO_LONGS(pfn_last - pfn_first), - sizeof(unsigned long), GFP_KERNEL); + kvmppc_uvmem_bitmap = bitmap_zalloc(pfn_last - pfn_first, GFP_KERNEL); if (!kvmppc_uvmem_bitmap) { ret = -ENOMEM; goto out_unmap; @@ -1215,5 +1214,5 @@ void kvmppc_uvmem_free(void) memunmap_pages(&kvmppc_uvmem_pgmap); release_mem_region(kvmppc_uvmem_pgmap.range.start, range_len(&kvmppc_uvmem_pgmap.range)); - kfree(kvmppc_uvmem_bitmap); + bitmap_free(kvmppc_uvmem_bitmap); } |