[ofa-general] [2.6 patch] infiniband/hw/nes/nes_cm.c: fix a memory leak

Adrian Bunk bunk at kernel.org
Tue Feb 19 16:13:40 PST 2008


This patch fixes a memory leak spotted by the Coverity checker.

Signed-off-by: Adrian Bunk <bunk at kernel.org>

---
2d899a9f01001b2cccc210972b199b951b67ed51 diff --git a/drivers/infiniband/hw/nes/nes_cm.c b/drivers/infiniband/hw/nes/nes_cm.c
index bd5cfea..78e845c 100644
--- a/drivers/infiniband/hw/nes/nes_cm.c
+++ b/drivers/infiniband/hw/nes/nes_cm.c
@@ -370,11 +370,11 @@ int schedule_nes_timer(struct nes_cm_node *cm_node, struct sk_buff *skb,
 	int ret = 0;
 	u32 was_timer_set;
 
+	if (!cm_node)
+		return -EINVAL;
 	new_send = kzalloc(sizeof(*new_send), GFP_ATOMIC);
 	if (!new_send)
 		return -1;
-	if (!cm_node)
-		return -EINVAL;
 
 	/* new_send->timetosend = currenttime */
 	new_send->retrycount = NES_DEFAULT_RETRYS;




More information about the general mailing list