diff mbox series

[rdma-next,06/12] RDMA/mlx5: Use correct size for device resources

Message ID 20190328132742.12070-7-leon@kernel.org
State Not Applicable
Delegated to: David Miller
Headers show
Series Move IB representors to single IB device multiple ports | expand

Commit Message

Leon Romanovsky March 28, 2019, 1:27 p.m. UTC
From: Mark Bloch <markb@mellanox.com>

On allocation we use the array size and on destruction num_ports,
use the array size of destruction as well, in this context the array
corresponds to the native/actual ports on the NIC so no need to adjust
this logic for representors.

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

Patch

diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c
index e3483ecc2f98..14cc4c56e2b1 100644
--- a/drivers/infiniband/hw/mlx5/main.c
+++ b/drivers/infiniband/hw/mlx5/main.c
@@ -4862,8 +4862,6 @@  static int create_dev_resources(struct mlx5_ib_resources *devr)
 
 static void destroy_dev_resources(struct mlx5_ib_resources *devr)
 {
-	struct mlx5_ib_dev *dev =
-		container_of(devr, struct mlx5_ib_dev, devr);
 	int port;
 
 	mlx5_ib_destroy_srq(devr->s1);
@@ -4877,7 +4875,7 @@  static void destroy_dev_resources(struct mlx5_ib_resources *devr)
 	kfree(devr->p0);
 
 	/* Make sure no change P_Key work items are still executing */
-	for (port = 0; port < dev->num_ports; ++port)
+	for (port = 0; port < ARRAY_SIZE(devr->ports); ++port)
 		cancel_work_sync(&devr->ports[port].pkey_change_work);
 }