diff mbox

mlx4/ib: Fix WARNING: at lib/swiotlb.c:562

Message ID 4D079E34.5070003@dev.mellanox.co.il (mailing list archive)
State Accepted
Headers show

Commit Message

Vladimir Sokolovsky Dec. 14, 2010, 4:41 p.m. UTC
None
diff mbox

Patch

diff --git a/drivers/infiniband/hw/mlx4/cq.c b/drivers/infiniband/hw/mlx4/cq.c
index 5a219a2..e8df155 100644
--- a/drivers/infiniband/hw/mlx4/cq.c
+++ b/drivers/infiniband/hw/mlx4/cq.c
@@ -397,10 +397,14 @@  int mlx4_ib_resize_cq(struct ib_cq *ibcq, int entries, struct ib_udata *udata)
  		cq->resize_buf = NULL;
  		cq->resize_umem = NULL;
  	} else {
+		struct mlx4_ib_cq_buf tmp_buf;
+		int tmp_cqe = 0;
+
  		spin_lock_irq(&cq->lock);
  		if (cq->resize_buf) {
  			mlx4_ib_cq_resize_copy_cqes(cq);
-			mlx4_ib_free_cq_buf(dev, &cq->buf, cq->ibcq.cqe);
+			tmp_buf = cq->buf;
+			tmp_cqe = cq->ibcq.cqe;
  			cq->buf      = cq->resize_buf->buf;
  			cq->ibcq.cqe = cq->resize_buf->cqe;

@@ -408,6 +412,9 @@  int mlx4_ib_resize_cq(struct ib_cq *ibcq, int entries, struct ib_udata *udata)
  			cq->resize_buf = NULL;
  		}
  		spin_unlock_irq(&cq->lock);
+
+		if (tmp_cqe)
+			mlx4_ib_free_cq_buf(dev, &tmp_buf, tmp_cqe);
  	}

  	goto out;