]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
IB/sdp: Fix error handling for case when mr allocation fails
authorMichael S. Tsirkin <mst@mellanox.co.il>
Sun, 16 Jul 2006 11:42:26 +0000 (14:42 +0300)
committerMukesh Kacker <mukesh.kacker@oracle.com>
Tue, 6 Oct 2015 12:03:51 +0000 (05:03 -0700)
drivers/infiniband/ulp/sdp/sdp_cma.c

index 156900f0918a4fe4ccda01cb7650595bb230bf73..b98dae062fa42590716dac04e75a002dc55f1da3 100644 (file)
@@ -102,6 +102,7 @@ int sdp_init_qp(struct sock *sk, struct rdma_cm_id *id)
        };
        struct ib_device *device = id->device;
        struct ib_cq *cq;
+       struct ib_pd *mr;
        struct ib_pd *pd;
        int rc;
 
@@ -132,13 +133,14 @@ int sdp_init_qp(struct sock *sk, struct rdma_cm_id *id)
                goto err_pd;
        }
        
-        sdp_sk(sk)->mr = ib_get_dma_mr(pd, IB_ACCESS_LOCAL_WRITE);
-        if (IS_ERR(sdp_sk(sk)->mr)) {
-                rc = PTR_ERR(sdp_sk(sk)->mr);
+        mr = ib_get_dma_mr(pd, IB_ACCESS_LOCAL_WRITE);
+        if (IS_ERR(mr)) {
+                rc = PTR_ERR(mr);
                sdp_warn(sk, "Unable to get dma MR: %d.\n", rc);
                 goto err_mr;
         }
 
+       sdp_sk(sk)->mr = mr;
        INIT_WORK(&sdp_sk(sk)->work, sdp_work, sdp_sk(sk));
 
        cq = ib_create_cq(device, sdp_completion_handler, sdp_cq_event_handler,