[openib-general] [PATCH] ib_mad.c: In ib_mad_post_send, return error code from ib_post_send

Hal Rosenstock halr at voltaire.com
Fri Sep 10 13:55:39 PDT 2004


ib_mad.c: In ib_mad_post_send, return error code from ib_post_send
rather than "overwrite" with EINVAL

Index: ib_mad.c
===================================================================
--- ib_mad.c	(revision 769)
+++ ib_mad.c	(working copy)
@@ -319,6 +319,7 @@
 		     struct ib_send_wr *send_wr,
 		     struct ib_send_wr **bad_send_wr)
 {
+	int ret;
 	struct ib_send_wr	*cur_send_wr, *next_send_wr;
 	struct ib_send_wr	wr;
 	struct ib_send_wr	*bad_wr;
@@ -363,14 +364,15 @@
 			      &((struct ib_mad_port_private
*)mad_agent->device->mad)->send_posted_mad_list);
 		IB_MAD_SEND_LIST_UNLOCK(((struct ib_mad_port_private
*)mad_agent->device->mad));
 
-		if (ib_post_send(mad_agent->qp, &wr, &bad_wr)) {
+		ret = ib_post_send(mad_agent->qp, &wr, &bad_wr);
+		if (ret) {
 			/* Unlink from posted send MAD list */
 			IB_MAD_SEND_LIST_LOCK(((struct ib_mad_port_private
*)mad_agent->device->mad));
 			list_del((struct list_head *)send_wr);
 			IB_MAD_SEND_LIST_UNLOCK(((struct ib_mad_port_private
*)mad_agent->device->mad));
 			*bad_send_wr = cur_send_wr;
 			printk(KERN_ERR "ib_mad_post_send failed\n");
-			return -EINVAL;		
+			return ret;		
 		}
 		cur_send_wr= next_send_wr;
 	}





More information about the general mailing list