[openib-general] [PATCH 12/13] Re-write cma_add_one error cases

Krishna Kumar krkumar2 at in.ibm.com
Wed Oct 11 21:54:28 PDT 2006


diff -ruNp org/drivers/infiniband/core/cma.c new/drivers/infiniband/core/cma.c
--- org/drivers/infiniband/core/cma.c	2006-10-09 16:40:04.000000000 +0530
+++ new/drivers/infiniband/core/cma.c	2006-10-09 16:52:03.000000000 +0530
@@ -2288,14 +2288,15 @@ static void cma_add_one(struct ib_device
 	struct cma_device *cma_dev;
 	struct rdma_id_private *id_priv;
 
+	if (!device->node_guid)
+		return;
+
 	cma_dev = kmalloc(sizeof *cma_dev, GFP_KERNEL);
 	if (!cma_dev)
 		return;
 
 	cma_dev->device = device;
 	cma_dev->node_guid = device->node_guid;
-	if (!cma_dev->node_guid)
-		goto err;
 
 	init_completion(&cma_dev->comp);
 	atomic_set(&cma_dev->refcount, 1);
@@ -2307,9 +2308,6 @@ static void cma_add_one(struct ib_device
 	list_for_each_entry(id_priv, &listen_any_list, list)
 		cma_listen_on_dev(id_priv, cma_dev);
 	mutex_unlock(&lock);
-	return;
-err:
-	kfree(cma_dev);
 }
 
 static int cma_remove_id_dev(struct rdma_id_private *id_priv)




More information about the general mailing list