[MLX4] more clean allocation of WRID array (replaces 1624-1625).
authorleonidk <leonidk@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Thu, 2 Oct 2008 09:25:20 +0000 (09:25 +0000)
committerleonidk <leonidk@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Thu, 2 Oct 2008 09:25:20 +0000 (09:25 +0000)
Signed-off_by: Alex Estrin

git-svn-id: svn://openib.tc.cornell.edu/gen1/trunk@1627 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86

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

index 2a03a73..2a9131c 100644 (file)
@@ -412,15 +412,20 @@ static int create_qp_common(struct mlx4_ib_dev *dev, struct ib_pd *pd,
                if (err)\r
                        goto err_mtt;\r
 \r
-               if (qp->sq.wqe_cnt)\r
+               if (qp->sq.wqe_cnt) {\r
                        qp->sq.wrid  = kmalloc(qp->sq.wqe_cnt * sizeof (u64), GFP_KERNEL);\r
+                       if (!qp->sq.wrid) {\r
+                               err = -ENOMEM;\r
+                               goto err_wrid;\r
+                       }\r
+               }                       \r
 \r
-               if (qp->rq.wqe_cnt)\r
+               if (qp->rq.wqe_cnt) {\r
                        qp->rq.wrid  = kmalloc(qp->rq.wqe_cnt * sizeof (u64), GFP_KERNEL);\r
-\r
-               if (!qp->sq.wrid && !qp->rq.wrid) {\r
-                       err = -ENOMEM;\r
-                       goto err_wrid;\r
+                       if (!qp->rq.wrid) {\r
+                               err = -ENOMEM;\r
+                               goto err_wrid;\r
+                       }\r
                }\r
        }\r
 \r