Prefer kcalloc() to kzalloc(array_size()) for allocating an array.
Showing the changes to kernel (1 of 1 file). Show all
Unified · Split
| @@ -818,8 +818,7 @@ static int rmem_swiotlb_device_init(struct reserved_mem *rmem, · 817 unmodified lines | ||
| 818 | 818 | if (!mem) |
| 819 | 819 | return -ENOMEM; |
| 820 | 820 | |
| 821 | − mem->slots = kzalloc(array_size(sizeof(*mem->slots), nslabs), | |
| 822 | − GFP_KERNEL); | |
| 821 | + mem->slots = kcalloc(nslabs, sizeof(*mem->slots), GFP_KERNEL); | |
| 823 | 822 | if (!mem->slots) { |
| 824 | 823 | kfree(mem); |
| 825 | 824 | return -ENOMEM; |