Re: [PATCH v2 15/27] net: use zeroing allocator rather than allocator followed by memset zero
From: Tariq Toukan
Date: Sun Jun 30 2019 - 08:19:58 EST
On 6/28/2019 5:48 AM, Fuqian Huang wrote:
> Replace allocator followed by memset with 0 with zeroing allocator.
>
> Signed-off-by: Fuqian Huang <huangfq.daxian@xxxxxxxxx>
> ---
..
> --- a/drivers/net/ethernet/mellanox/mlx4/en_rx.c
> +++ b/drivers/net/ethernet/mellanox/mlx4/en_rx.c
> @@ -1062,7 +1062,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;
>
> @@ -1073,7 +1073,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);
>
For the mlx4 part:
Reviewed-by: Tariq Toukan <tariqt@xxxxxxxxxxxx>
Tariq