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
818818 if (!mem)
819819 return -ENOMEM;
820820
821− mem->slots = kzalloc(array_size(sizeof(*mem->slots), nslabs),
822− GFP_KERNEL);
821+ mem->slots = kcalloc(nslabs, sizeof(*mem->slots), GFP_KERNEL);
823822 if (!mem->slots) {
824823 kfree(mem);
825824 return -ENOMEM;