From: Tariq Toukan <ttoukan.linux@gmail.com>
To: Julia Lawall <Julia.Lawall@inria.fr>, Tariq Toukan <tariqt@nvidia.com>
Cc: kernel-janitors@vger.kernel.org,
"David S. Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>,
netdev@vger.kernel.org, linux-rdma@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/6] net/mlx4_en: use kzalloc
Date: Mon, 14 Mar 2022 14:37:29 +0200 [thread overview]
Message-ID: <66fa1399-cc4b-8bdc-d4bc-ed9befe1803e@gmail.com> (raw)
In-Reply-To: <20220312102705.71413-3-Julia.Lawall@inria.fr>
On 3/12/2022 12:27 PM, Julia Lawall wrote:
> Use kzalloc instead of kmalloc + memset.
>
> The semantic patch that makes this change is:
> (https://coccinelle.gitlabpages.inria.fr/website/)
>
> //<smpl>
> @@
> expression res, size, flag;
> @@
> - res = kmalloc(size, flag);
> + res = kzalloc(size, flag);
> ...
> - memset(res, 0, size);
> //</smpl>
>
> Signed-off-by: Julia Lawall <Julia.Lawall@inria.fr>
>
> ---
> drivers/net/ethernet/mellanox/mlx4/en_rx.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/net/ethernet/mellanox/mlx4/en_rx.c b/drivers/net/ethernet/mellanox/mlx4/en_rx.c
> index 8cfc649f226b..8f762fc170b3 100644
> --- a/drivers/net/ethernet/mellanox/mlx4/en_rx.c
> +++ b/drivers/net/ethernet/mellanox/mlx4/en_rx.c
> @@ -1067,7 +1067,7 @@ static int mlx4_en_config_rss_qp(struct mlx4_en_priv *priv, int qpn,
> struct mlx4_qp_context *context;
> int err = 0;
>
> - context = kmalloc(sizeof(*context), GFP_KERNEL);
> + context = kzalloc(sizeof(*context), GFP_KERNEL);
> if (!context)
> return -ENOMEM;
>
> @@ -1078,7 +1078,6 @@ static int mlx4_en_config_rss_qp(struct mlx4_en_priv *priv, int qpn,
> }
> qp->event = mlx4_en_sqp_event;
>
> - memset(context, 0, sizeof(*context));
> mlx4_en_fill_qp_context(priv, ring->actual_size, ring->stride, 0, 0,
> qpn, ring->cqn, -1, context);
> context->db_rec_addr = cpu_to_be64(ring->wqres.db.dma);
>
Thanks for your patch.
Reviewed-by: Tariq Toukan <tariqt@nvidia.com>
next prev parent reply other threads:[~2022-03-14 12:45 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-12 10:26 [PATCH 0/6] use kzalloc Julia Lawall
2022-03-12 10:27 ` [PATCH 1/6] cifs: " Julia Lawall
2022-03-15 4:15 ` Steve French
2022-03-12 10:27 ` [PATCH 2/6] net/mlx4_en: " Julia Lawall
2022-03-14 12:37 ` Tariq Toukan [this message]
2022-03-12 10:27 ` [PATCH 3/6] ALSA: seq: oss: " Julia Lawall
2022-03-12 21:43 ` Joe Perches
2022-03-13 8:09 ` Takashi Iwai
2022-03-12 10:27 ` [PATCH 4/6] scsi: lpfc: " Julia Lawall
2022-03-12 21:45 ` Joe Perches
2022-03-14 11:34 ` Dan Carpenter
2022-03-14 11:50 ` Julia Lawall
2022-03-12 10:27 ` [PATCH 5/6] zd1201: " Julia Lawall
2022-03-16 15:29 ` Kalle Valo
2022-03-12 10:27 ` [PATCH 6/6] usb: raw-gadget: " Julia Lawall
2022-03-14 20:30 ` [PATCH 0/6] " 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=66fa1399-cc4b-8bdc-d4bc-ed9befe1803e@gmail.com \
--to=ttoukan.linux@gmail.com \
--cc=Julia.Lawall@inria.fr \
--cc=davem@davemloft.net \
--cc=kernel-janitors@vger.kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=tariqt@nvidia.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).