[mlx4] Fix error path on create qp.
authortzachid <tzachid@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Tue, 3 Mar 2009 09:45:11 +0000 (09:45 +0000)
committertzachid <tzachid@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Tue, 3 Mar 2009 09:45:11 +0000 (09:45 +0000)
git-svn-id: svn://openib.tc.cornell.edu/gen1/trunk@2002 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86

hw/mlx4/kernel/bus/drv/pci.c
hw/mlx4/kernel/bus/ib/qp.c

index b8c0e6c..04682c2 100644 (file)
@@ -600,6 +600,8 @@ pci_hca_reset(
 \r
        MLX4_ENTER( MLX4_DBG_PNP );\r
 \r
+       ASSERT(KeGetCurrentIrql() == PASSIVE_LEVEL);\r
+\r
        /* save Card Config Space including MSI-X capabilities */\r
        pci_get_msi_info( pdev, p_cfg, &pdev->uplink_info );\r
 \r
@@ -722,6 +724,7 @@ err:
        if (pdev->msix_info.valid) \r
                pci_free_msix_info_resources(&pdev->msix_info);\r
        MLX4_EXIT( MLX4_DBG_PNP );\r
+       ASSERT(KeGetCurrentIrql() == PASSIVE_LEVEL);\r
        return status;\r
 }\r
 \r
index d7528c4..47378d2 100644 (file)
@@ -326,6 +326,7 @@ static int create_qp_common(struct mlx4_ib_dev *dev, struct ib_pd *pd,
                            struct ib_udata *udata, u32 sqpn, struct mlx4_ib_qp *qp)\r
 {\r
        int err;\r
+       BOOLEAN range_allocated = FALSE;\r
 \r
        mutex_init(&qp->mutex);\r
        spin_lock_init(&qp->sq.lock);\r
@@ -429,19 +430,17 @@ static int create_qp_common(struct mlx4_ib_dev *dev, struct ib_pd *pd,
                }\r
        }\r
 \r
-       if (!sqpn)\r
-               err = mlx4_qp_reserve_range(dev->dev, 1, 1, &sqpn);\r
-       if (err)\r
-               goto err_wrid;\r
+       if (!sqpn) {\r
+                       err = mlx4_qp_reserve_range(dev->dev, 1, 1, &sqpn);\r
+               if (err)\r
+                       goto err_wrid;\r
+               range_allocated = TRUE;\r
+               \r
+       }\r
 \r
        err = mlx4_qp_alloc(dev->dev, sqpn, &qp->mqp);\r
        if (err)\r
-               goto err_wrid;\r
-\r
-       if (err) {\r
-               mlx4_qp_release_range(dev->dev, sqpn, 1);\r
-               goto err_wrid;\r
-       }\r
+               goto err_range;\r
 \r
        /*\r
         * Hardware wants QPN written in big-endian order (after\r
@@ -459,6 +458,10 @@ static int create_qp_common(struct mlx4_ib_dev *dev, struct ib_pd *pd,
 \r
        return 0;\r
 \r
+err_range:\r
+       if (range_allocated)\r
+               mlx4_qp_release_range(dev->dev, sqpn, 1);\r
+\r
 err_wrid:\r
        if (pd->p_uctx) {\r
                if (!init_attr->srq)\r