mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2025-01-15 11:37:47 +00:00
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>
This commit is contained in:
parent
c0a4191c27
commit
404f9373c4
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user