All of lore.kernel.org
 help / color / mirror / Atom feed
From: Simon Horman <simon.horman@corigine.com>
To: Robin Murphy <robin.murphy@arm.com>
Cc: kuba@kernel.org, davem@davemloft.net, oss-drivers@corigine.com,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next] nfp: nsp: Simplify array allocation
Date: Thu, 27 Jan 2022 10:06:37 +0100	[thread overview]
Message-ID: <20220127090636.GA21279@corigine.com> (raw)
In-Reply-To: <af578bd3eb471b9613bcba7f714cca7e297a4620.1643214385.git.robin.murphy@arm.com>

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
> 

  reply	other threads:[~2022-01-27  9:06 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-26 16:30 [PATCH net-next] nfp: nsp: Simplify array allocation Robin Murphy
2022-01-27  9:06 ` Simon Horman [this message]
2022-01-27 12:42   ` Robin Murphy
2022-01-27 14:00 ` patchwork-bot+netdevbpf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220127090636.GA21279@corigine.com \
    --to=simon.horman@corigine.com \
    --cc=davem@davemloft.net \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=oss-drivers@corigine.com \
    --cc=robin.murphy@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.