netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tariq Toukan <tariqt@mellanox.com>
To: Robert Eshleman <bobbyeshleman@gmail.com>
Cc: Tariq Toukan <tariqt@mellanox.com>,
	"David S. Miller" <davem@davemloft.net>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"linux-rdma@vger.kernel.org" <linux-rdma@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 1/8] net/mlx4: use kzalloc instead of kmalloc
Date: Thu, 28 Feb 2019 08:40:35 +0000	[thread overview]
Message-ID: <b691702d-e7d8-226a-f225-75f2e0a810a9@mellanox.com> (raw)
In-Reply-To: <b350ebb5410291e80e12244ccb41b4b4bae31e0c.1551246708.git.bobbyeshleman@gmail.com>



On 2/27/2019 8:09 AM, Robert Eshleman wrote:
> This patch replaces a kmalloc/memset(,0) call with a call to kzalloc.
> It also removes a memset(,0) call that always follows a *zalloc call.
> 
> Signed-off-by: Robert Eshleman <bobbyeshleman@gmail.com>
> ---
>   drivers/net/ethernet/mellanox/mlx4/cmd.c   | 1 -
>   drivers/net/ethernet/mellanox/mlx4/en_rx.c | 3 +--
>   2 files changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/drivers/net/ethernet/mellanox/mlx4/cmd.c b/drivers/net/ethernet/mellanox/mlx4/cmd.c
> index e65bc3c95630..7bfa6e850e5f 100644
> --- a/drivers/net/ethernet/mellanox/mlx4/cmd.c
> +++ b/drivers/net/ethernet/mellanox/mlx4/cmd.c
> @@ -3307,7 +3307,6 @@ int mlx4_get_counter_stats(struct mlx4_dev *dev, int counter_index,
>   	if (IS_ERR(mailbox))
>   		return PTR_ERR(mailbox);
>   
> -	memset(mailbox->buf, 0, sizeof(struct mlx4_counter));
>   	if_stat_in_mod = counter_index;
>   	if (reset)
>   		if_stat_in_mod |= MLX4_QUERY_IF_STAT_RESET;
> diff --git a/drivers/net/ethernet/mellanox/mlx4/en_rx.c b/drivers/net/ethernet/mellanox/mlx4/en_rx.c
> index 9a0881cb7f51..f55805d206ef 100644
> --- a/drivers/net/ethernet/mellanox/mlx4/en_rx.c
> +++ b/drivers/net/ethernet/mellanox/mlx4/en_rx.c
> @@ -1044,7 +1044,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;
>   
> @@ -1055,7 +1055,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);
> 

Hi,

Thanks for your patch.
It looks good, but misses one similar point you might want to cover:

in drivers/net/ethernet/mellanox/mlx4/port.c:1780 :
memset(context, 0, sizeof(*context));

Tariq

  reply	other threads:[~2019-02-28  8:40 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-27  6:04 [PATCH 0/8] net: ethernet: reduce calls to memset(,0) Robert Eshleman
2019-02-27  6:09 ` [PATCH 2/8] net/mlxsw: use pci_zalloc_consistent instead of pci_alloc_consistent Robert Eshleman
2019-02-27  6:09 ` [PATCH 3/8] tlan: use pci_zalloc instead of pci_alloc Robert Eshleman
2019-02-27  6:22   ` Joe Perches
2019-02-28  0:41     ` Robert Eshleman
2019-02-27  6:09 ` [PATCH 4/8] qed: remove unnecessary memsets Robert Eshleman
2019-02-27 12:39   ` Michal Kalderon
2019-02-27  6:09 ` [PATCH 5/8] at12: use pci_zalloc instead of pci_alloc Robert Eshleman
2019-02-28 14:00   ` Christoph Hellwig
2019-02-27  6:09 ` [PATCH 6/8] netxen: remove unnecessary memset(,0) calls Robert Eshleman
2019-02-27  6:09 ` [PATCH 7/8] net: seeq: replace kmalloc / memset(,0) with kzalloc Robert Eshleman
2019-02-28  0:48   ` Robert Eshleman
2019-02-27  6:09 ` [PATCH 8/8] net: ethernet: ixp4xx_eth: remove memset(,0) with zalloc Robert Eshleman
2019-02-27  6:09 ` [PATCH 1/8] net/mlx4: use kzalloc instead of kmalloc Robert Eshleman
2019-02-28  8:40   ` Tariq Toukan [this message]
2019-02-28 14:25 ` [PATCH 0/8] net: ethernet: reduce calls to memset(,0) Christoph Hellwig

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=b691702d-e7d8-226a-f225-75f2e0a810a9@mellanox.com \
    --to=tariqt@mellanox.com \
    --cc=bobbyeshleman@gmail.com \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    /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).