OSDN Git Service

nfp: Simplify array allocation
authorRobin Murphy <robin.murphy@arm.com>
Wed, 26 Jan 2022 16:30:33 +0000 (16:30 +0000)
committerDavid S. Miller <davem@davemloft.net>
Thu, 27 Jan 2022 13:50:34 +0000 (13:50 +0000)
Prefer kcalloc() to kzalloc(array_size()) for allocating an array.

Signed-off-by: Robin Murphy <robin.murphy@arm.com>
Acked-by: Simon Horman <simon.horman@corigine.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/netronome/nfp/nfpcore/nfp_nsp.c

index 10e7d8b..730fea2 100644 (file)
@@ -513,7 +513,7 @@ nfp_nsp_command_buf_dma_sg(struct nfp_nsp *nsp,
        dma_size = BIT_ULL(dma_order);
        nseg = DIV_ROUND_UP(max_size, chunk_size);
 
-       chunks = kzalloc(array_size(sizeof(*chunks), nseg), GFP_KERNEL);
+       chunks = kcalloc(nseg, sizeof(*chunks), GFP_KERNEL);
        if (!chunks)
                return -ENOMEM;