summaryrefslogtreecommitdiff
path: root/kernel/dma
diff options
context:
space:
mode:
authorRobin Murphy <robin.murphy@arm.com>2022-01-24 16:40:19 +0000
committerChristoph Hellwig <hch@lst.de>2022-01-26 17:21:19 +0100
commit404f9373c4e5c943ed8a5e71c8dcfef9eddd54ab (patch)
tree6d2f19bef6a14d3a1e22ea035bb476bec8c46068 /kernel/dma
parentc0a4191c27a12d3175283fa33f16db20e91008fd (diff)
swiotlb: simplify array allocation
Prefer kcalloc() to kzalloc(array_size()) for allocating an array. Signed-off-by: Robin Murphy <robin.murphy@arm.com> Signed-off-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'kernel/dma')
-rw-r--r--kernel/dma/swiotlb.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/kernel/dma/swiotlb.c b/kernel/dma/swiotlb.c
index f3ff0af49f81..908eac2527cb 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;