[ofa-general] [PATCH] srp: Check the return values of the functions ib_get_cached_gid

Dotan Barak dotanb at dev.mellanox.co.il
Sun Jan 6 23:24:25 PST 2008


Added a check to the return value of ib_get_cached_gid 
before using the value that it set (becasue this function may fail).

Signed-off-by: Dotan Barak <dotanb at dev.mellanox.co.il>

---

diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c
index 950228f..fcefa50 100644
--- a/drivers/infiniband/ulp/srp/ib_srp.c
+++ b/drivers/infiniband/ulp/srp/ib_srp.c
@@ -1812,7 +1812,9 @@ static ssize_t srp_create_target(struct class_device *class_dev,
 	if (ret)
 		goto err;
 
-	ib_get_cached_gid(host->dev->dev, host->port, 0, &target->path.sgid);
+	ret = ib_get_cached_gid(host->dev->dev, host->port, 0, &target->path.sgid);
+	if (ret)
+		goto err;
 
 	printk(KERN_DEBUG PFX "new target: id_ext %016llx ioc_guid %016llx pkey %04x "
 	       "service_id %016llx dgid %04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x\n",



More information about the general mailing list