diff mbox series

[rdma-next] RDMA/mlx5: Use proper allocation API to get zeroed memory

Message ID 20190630154832.21388-1-leon@kernel.org (mailing list archive)
State Mainlined
Commit 50ba3c18a4e549ba6a5a4672dfb3eb30fcb7d570
Delegated to: Jason Gunthorpe
Headers show
Series [rdma-next] RDMA/mlx5: Use proper allocation API to get zeroed memory | expand

Commit Message

Leon Romanovsky June 30, 2019, 3:48 p.m. UTC
From: Leon Romanovsky <leonro@mellanox.com>

There is no need in custom memory zeroing, because it can be done
by using kzalloc from the beginning.

Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
---
 drivers/infiniband/hw/mlx5/main.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Jason Gunthorpe July 4, 2019, 5:09 p.m. UTC | #1
On Sun, Jun 30, 2019 at 06:48:32PM +0300, Leon Romanovsky wrote:
> From: Leon Romanovsky <leonro@mellanox.com>
> 
> There is no need in custom memory zeroing, because it can be done
> by using kzalloc from the beginning.
> 
> Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
> ---
>  drivers/infiniband/hw/mlx5/main.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)

Applied to for-next, thanks

Jason
diff mbox series

Patch

diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c
index aa5af73acfc7..6686f8f876f0 100644
--- a/drivers/infiniband/hw/mlx5/main.c
+++ b/drivers/infiniband/hw/mlx5/main.c
@@ -4682,7 +4682,7 @@  static int __get_port_caps(struct mlx5_ib_dev *dev, u8 port)
 	int err = -ENOMEM;
 	struct ib_udata uhw = {.inlen = 0, .outlen = 0};
 
-	pprops = kmalloc(sizeof(*pprops), GFP_KERNEL);
+	pprops = kzalloc(sizeof(*pprops), GFP_KERNEL);
 	if (!pprops)
 		goto out;
 
@@ -4696,7 +4696,6 @@  static int __get_port_caps(struct mlx5_ib_dev *dev, u8 port)
 		goto out;
 	}
 
-	memset(pprops, 0, sizeof(*pprops));
 	err = mlx5_ib_query_port(&dev->ib_dev, port, pprops);
 	if (err) {
 		mlx5_ib_warn(dev, "query_port %d failed %d\n",