Subject: [PATCH rdma-next 3/8] IB/mlx5: Warn on allocated MEMIC buffers during cleanup

From: Leon Romanovsky <[email-masked]>
Date: Sun, 31 Mar 2019 19:44:45 +0300

From: Ariel Levkovich <[email-masked]>

Adding a warning on allocated MEMIC buffers that weren't
freed prior to driver tear down.

Signed-off-by: Ariel Levkovich <[email-masked]>
Reviewed-by: Eli Cohen <[email-masked]>
Reviewed-by: Mark Bloch <[email-masked]>
Signed-off-by: Leon Romanovsky <[email-masked]>
---
 drivers/infiniband/hw/mlx5/main.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c
index 562826ecfbdd..23436feaa22f 100644
--- a/drivers/infiniband/hw/mlx5/main.c
+++ b/drivers/infiniband/hw/mlx5/main.c
@@ -6005,6 +6005,8 @@ static void mlx5_ib_stage_init_cleanup(struct mlx5_ib_dev *dev)
 		srcu_barrier(&dev->mr_srcu);
 		cleanup_srcu_struct(&dev->mr_srcu);
 	}
+
+	WARN_ON(!bitmap_empty(dev->dm.memic_alloc_pages, MLX5_MAX_MEMIC_PAGES));
 }
 
 static int mlx5_ib_stage_init_init(struct mlx5_ib_dev *dev)
-- 
2.20.1