From: Robin Murphy Date: Mon, 24 Jan 2022 16:40:19 +0000 (+0000) Subject: swiotlb: simplify array allocation X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=404f9373c4e5c943ed8a5e71c8dcfef9eddd54ab;p=linux.git swiotlb: simplify array allocation Prefer kcalloc() to kzalloc(array_size()) for allocating an array. Signed-off-by: Robin Murphy Signed-off-by: Christoph Hellwig --- diff --git a/kernel/dma/swiotlb.c b/kernel/dma/swiotlb.c index f3ff0af49f814..908eac2527cb1 100644 --- a/kernel/dma/swiotlb.c +++ b/kernel/dma/swiotlb.c @@ -818,8 +818,7 @@ static int rmem_swiotlb_device_init(struct reserved_mem *rmem, if (!mem) return -ENOMEM; - mem->slots = kzalloc(array_size(sizeof(*mem->slots), nslabs), - GFP_KERNEL); + mem->slots = kcalloc(nslabs, sizeof(*mem->slots), GFP_KERNEL); if (!mem->slots) { kfree(mem); return -ENOMEM;