lkml.org 
[lkml]   [2022]   [Jan]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [PATCH net-next] nfp: nsp: Simplify array allocation
On Wed, Jan 26, 2022 at 04:30:33PM +0000, Robin Murphy wrote:
> Prefer kcalloc() to kzalloc(array_size()) for allocating an array.
>
> Signed-off-by: Robin Murphy <robin.murphy@arm.com>

Hi Robin,

thanks for the cleanup.

One minor nit: I think "nfp: " would be a slightly more normal prefix
than "nfp: nsp: ".

That notwithstanding,

Acked-by: Simon Horman <simon.horman@corigine.com>

> ---
> drivers/net/ethernet/netronome/nfp/nfpcore/nfp_nsp.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/netronome/nfp/nfpcore/nfp_nsp.c b/drivers/net/ethernet/netronome/nfp/nfpcore/nfp_nsp.c
> index 10e7d8b21c46..730fea214b8a 100644
> --- a/drivers/net/ethernet/netronome/nfp/nfpcore/nfp_nsp.c
> +++ b/drivers/net/ethernet/netronome/nfp/nfpcore/nfp_nsp.c
> @@ -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;
>
> --
> 2.28.0.dirty
>

\
 
 \ /
  Last update: 2022-01-27 10:07    [W:0.241 / U:0.072 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site