All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hal Rosenstock <hal-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
To: "linux-rdma
	(linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org)"
	<linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Cc: Alex Netes <alexne-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Subject: [PATCH] opensm/osm_req.c: Better implementation of req_determine_mkey
Date: Fri, 22 Feb 2013 10:34:45 -0500	[thread overview]
Message-ID: <51279015.10105@dev.mellanox.co.il> (raw)


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

                 reply	other threads:[~2013-02-22 15:34 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=51279015.10105@dev.mellanox.co.il \
    --to=hal-ldsdmyg8hgv8yrgs2mwiifqbs+8scbdb@public.gmane.org \
    --cc=alexne-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org \
    --cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.