Skip to content

Commit 404f937

Browse files
rmurphy-armChristoph Hellwig
authored andcommitted
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>
1 parent c0a4191 commit 404f937

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

kernel/dma/swiotlb.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -818,8 +818,7 @@ static int rmem_swiotlb_device_init(struct reserved_mem *rmem,
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;

0 commit comments

Comments
 (0)