IB/srp: Check ib_query_gid return value
authorSagi Grimberg <sagig@mellanox.com>
Fri, 14 Mar 2014 12:51:58 +0000 (13:51 +0100)
committerRoland Dreier <roland@purestorage.com>
Mon, 24 Mar 2014 17:05:30 +0000 (10:05 -0700)
Detected by Coverity.

Signed-off-by: Sagi Grimberg <sagig@mellanox.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Roland Dreier <roland@purestorage.com>
drivers/infiniband/ulp/srp/ib_srp.c

index 529b6bcdca7a5267570a81c4b031a069b8692235..890322637e2ee0f512fe248fea80ccf6bb524d3e 100644 (file)
@@ -2649,7 +2649,9 @@ static ssize_t srp_create_target(struct device *dev,
        if (ret)
                goto err_free_mem;
 
-       ib_query_gid(ibdev, host->port, 0, &target->path.sgid);
+       ret = ib_query_gid(ibdev, host->port, 0, &target->path.sgid);
+       if (ret)
+               goto err_free_mem;
 
        shost_printk(KERN_DEBUG, target->scsi_host, PFX
                     "new target: id_ext %016llx ioc_guid %016llx pkey %04x "