Merge tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma
[sfrench/cifs-2.6.git] / drivers / net / ethernet / mellanox / mlx5 / core / debugfs.c
index fc13b41cc9b28376f1d5f4cfd75812aac5053c2a..2138f28a293182150421477ddb5523300485bac5 100644 (file)
@@ -514,11 +514,11 @@ EXPORT_SYMBOL(mlx5_debug_qp_add);
 
 void mlx5_debug_qp_remove(struct mlx5_core_dev *dev, struct mlx5_core_qp *qp)
 {
-       if (!mlx5_debugfs_root)
+       if (!mlx5_debugfs_root || !qp->dbg)
                return;
 
-       if (qp->dbg)
-               rem_res_tree(qp->dbg);
+       rem_res_tree(qp->dbg);
+       qp->dbg = NULL;
 }
 EXPORT_SYMBOL(mlx5_debug_qp_remove);