[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <c897238f-c0c9-a2b2-d3ae-c04012e976de@pensando.io>
Date: Sun, 9 Aug 2020 20:54:19 -0700
From: Shannon Nelson <snelson@...sando.io>
To: Xu Wang <vulab@...as.ac.cn>, drivers@...sando.io,
davem@...emloft.net, kuba@...nel.org, netdev@...r.kernel.org
Cc: linux-kernel@...r.kernel.org
Subject: Re: [PATCH] ionic_lif: Use devm_kcalloc() in ionic_qcq_alloc()
On 8/9/20 7:38 PM, Xu Wang wrote:
> A multiplication for the size determination of a memory allocation
> indicated that an array data structure should be processed.
> Thus use the corresponding function "devm_kcalloc".
>
> Signed-off-by: Xu Wang <vulab@...as.ac.cn>
Acked-by: Shannon Nelson <snelson@...sando.io>
> ---
> drivers/net/ethernet/pensando/ionic/ionic_lif.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/ethernet/pensando/ionic/ionic_lif.c b/drivers/net/ethernet/pensando/ionic/ionic_lif.c
> index 1944bf5264db..26988ad7ec97 100644
> --- a/drivers/net/ethernet/pensando/ionic/ionic_lif.c
> +++ b/drivers/net/ethernet/pensando/ionic/ionic_lif.c
> @@ -412,7 +412,7 @@ static int ionic_qcq_alloc(struct ionic_lif *lif, unsigned int type,
>
> new->flags = flags;
>
> - new->q.info = devm_kzalloc(dev, sizeof(*new->q.info) * num_descs,
> + new->q.info = devm_kcalloc(dev, num_descs, sizeof(*new->q.info),
> GFP_KERNEL);
> if (!new->q.info) {
> netdev_err(lif->netdev, "Cannot allocate queue info\n");
> @@ -462,7 +462,7 @@ static int ionic_qcq_alloc(struct ionic_lif *lif, unsigned int type,
> new->intr.index = IONIC_INTR_INDEX_NOT_ASSIGNED;
> }
>
> - new->cq.info = devm_kzalloc(dev, sizeof(*new->cq.info) * num_descs,
> + new->cq.info = devm_kcalloc(dev, num_descs, sizeof(*new->cq.info),
> GFP_KERNEL);
> if (!new->cq.info) {
> netdev_err(lif->netdev, "Cannot allocate completion queue info\n");
Powered by blists - more mailing lists