All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] opensm/osm_req.c: Better implementation of req_determine_mkey
@ 2013-02-22 15:34 Hal Rosenstock
  0 siblings, 0 replies; only message in thread
From: Hal Rosenstock @ 2013-02-22 15:34 UTC (permalink / raw)
  To: linux-rdma (linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org)
  Cc: Alex Netes


Eliminate compile warning:
osm_req.c: In function ‘req_determine_mkey’:
osm_req.c:69: warning: ‘p_node’ may be used uninitialized in this function

Signed-off-by: Alex Netes <alexne-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
---
diff --git a/opensm/osm_req.c b/opensm/osm_req.c
index f9ffc81..e0634e0 100644
--- a/opensm/osm_req.c
+++ b/opensm/osm_req.c
@@ -80,31 +80,27 @@ static ib_net64_t req_determine_mkey(IN osm_sm_t * sm,
 
 	/* hop_count == 0: destination port guid is SM */
 	if (p_path->hop_count == 0) {
-		if (p_sm_port != NULL)
-			dest_port_guid = sm->p_subn->sm_port_guid;
-		else
-			dest_port_guid = sm->p_subn->opt.guid;
+		dest_port_guid = sm->p_subn->sm_port_guid;
 		goto Remote_Guid;
 	}
 
 	if (p_sm_port) {
-		/* get the node for the SM */
 		p_node = p_sm_port->p_node;
-		p_physp = p_sm_port->p_physp;
+		if (osm_node_get_type(p_node) == IB_NODE_TYPE_SWITCH)
+			p_physp = osm_node_get_physp_ptr(p_node, p_path->path[1]);
+		else
+			p_physp = p_sm_port->p_physp;
 	}
 
-	for (hop = 1; p_physp && hop < p_path->hop_count; hop++) {
-		p_physp = osm_node_get_physp_ptr(p_node, p_path->path[hop]);
+	/* hop_count == 1: outgoing physp is SM physp */
+	for (hop = 2; p_physp && hop <= p_path->hop_count; hop++) {
+		p_physp = p_physp->p_remote_physp;
 		if (!p_physp)
 			break;
-		p_physp = osm_physp_get_remote(p_physp);
-		if (!p_physp)
-			break;
-		p_node = osm_physp_get_node_ptr(p_physp);
+		p_node = p_physp->p_node;
+		p_physp = osm_node_get_physp_ptr(p_node, p_path->path[hop]);
 	}
 
-	p_physp = osm_node_get_physp_ptr(p_node, p_path->path[hop]);
-
 	/* At this point, p_physp points at the outgoing physp on the
 	   last hop, or NULL if we don't know it.
 	*/
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2013-02-22 15:34 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-22 15:34 [PATCH] opensm/osm_req.c: Better implementation of req_determine_mkey Hal Rosenstock

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.