提交 5d8f6a0e 编写于 作者: M Mark Bloch 提交者: Jason Gunthorpe

RDMA/mlx5: Use correct size for device resources

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: NMark Bloch <markb@mellanox.com>
Signed-off-by: NLeon Romanovsky <leonro@mellanox.com>
Signed-off-by: NJason Gunthorpe <jgg@mellanox.com>
上级 da796ccb
...@@ -4866,8 +4866,6 @@ static int create_dev_resources(struct mlx5_ib_resources *devr) ...@@ -4866,8 +4866,6 @@ static int create_dev_resources(struct mlx5_ib_resources *devr)
static void destroy_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; int port;
mlx5_ib_destroy_srq(devr->s1, NULL); mlx5_ib_destroy_srq(devr->s1, NULL);
...@@ -4881,7 +4879,7 @@ static void destroy_dev_resources(struct mlx5_ib_resources *devr) ...@@ -4881,7 +4879,7 @@ static void destroy_dev_resources(struct mlx5_ib_resources *devr)
kfree(devr->p0); kfree(devr->p0);
/* Make sure no change P_Key work items are still executing */ /* 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); cancel_work_sync(&devr->ports[port].pkey_change_work);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册