[ofw] PATCH: [mlx4] Fix error path on create qp.

Tzachi Dar tzachid at mellanox.co.il
Mon Mar 2 05:46:14 PST 2009


Index: Q:/projinf2/trunk/hw/mlx4/kernel/bus/ib/qp.c
===================================================================
--- Q:/projinf2/trunk/hw/mlx4/kernel/bus/ib/qp.c (revision 4000)
+++ Q:/projinf2/trunk/hw/mlx4/kernel/bus/ib/qp.c (revision 4001)
@@ -326,6 +326,7 @@
        struct ib_udata *udata, u32 sqpn, struct mlx4_ib_qp *qp)
 {
  int err;
+ BOOLEAN range_allocated = 0;
 
  mutex_init(&qp->mutex);
  spin_lock_init(&qp->sq.lock);
@@ -429,20 +430,18 @@
   }
  }
 
- if (!sqpn)
-  err = mlx4_qp_reserve_range(dev->dev, 1, 1, &sqpn);
- if (err)
-  goto err_wrid;
+ if (!sqpn) {
+   err = mlx4_qp_reserve_range(dev->dev, 1, 1, &sqpn);
+  if (err)
+   goto err_wrid;
+  range_allocated = TRUE;
+  
+ }
 
  err = mlx4_qp_alloc(dev->dev, sqpn, &qp->mqp);
  if (err)
-  goto err_wrid;
+  goto err_range;
 
- if (err) {
-  mlx4_qp_release_range(dev->dev, sqpn, 1);
-  goto err_wrid;
- }
-
  /*
   * Hardware wants QPN written in big-endian order (after
   * shifting) for send doorbell.  Precompute this value to save
@@ -459,6 +458,10 @@
 
  return 0;
 
+err_range:
+ if (range_allocated)
+  mlx4_qp_release_range(dev->dev, sqpn, 1);
+
 err_wrid:
  if (pd->p_uctx) {
   if (!init_attr->srq)

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openfabrics.org/pipermail/ofw/attachments/20090302/6afe852a/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: qp_error.diff
Type: application/octet-stream
Size: 1245 bytes
Desc: qp_error.diff
URL: <http://lists.openfabrics.org/pipermail/ofw/attachments/20090302/6afe852a/attachment.obj>


More information about the ofw mailing list