History

swiotlb: simplify array allocation

Prefer kcalloc() to kzalloc(array_size()) for allocating an array.

Robin Murphy committed 4 years ago

Commit 404f9371 parent c0a41911 file · +1 −2Browse files

Showing the changes to kernel (1 of 1 file). Show all

Unified · Split

kernel/dma/swiotlb.c+1−2
@@ -818,8 +818,7 @@ static int rmem_swiotlb_device_init(struct reserved_mem *rmem, · 817 unmodified lines
818 if (!mem)818 if (!mem)
819 return -ENOMEM;819 return -ENOMEM;
820 820
821 mem->slots = kzalloc(array_size(sizeof(*mem->slots), nslabs),821 mem->slots = kcalloc(nslabs, sizeof(*mem->slots), GFP_KERNEL);
822 GFP_KERNEL);
823 if (!mem->slots) {822 if (!mem->slots) {
824 kfree(mem);823 kfree(mem);
825 return -ENOMEM;824 return -ENOMEM;