diff mbox

[opensm] osm_link_mgr.c: Fix uninitialized value (physp0)

Message ID 52829D4E.9070802@dev.mellanox.co.il (mailing list archive)
State Accepted
Delegated to: Hal Rosenstock
Headers show

Commit Message

Hal Rosenstock Nov. 12, 2013, 9:27 p.m. UTC
From: Alex Netes <alexne@mellanox.com>

physp0 might be uninitialized

Signed-off-by: Alex Netes <alexne@mellanox.com>
---
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/opensm/osm_link_mgr.c b/opensm/osm_link_mgr.c
index 44bfbe6..6bcfbf6 100644
--- a/opensm/osm_link_mgr.c
+++ b/opensm/osm_link_mgr.c
@@ -135,6 +135,9 @@  static int link_mgr_set_physp_pi(osm_sm_t * sm, IN osm_physp_t * p_physp,
 			send_set = TRUE;
 	}
 
+	if (osm_node_get_type(p_node) == IB_NODE_TYPE_SWITCH)
+		physp0 = osm_node_get_physp_ptr(p_node, 0);
+
 	if (port_num == 0) {
 		/*
 		   CAs don't have a port 0, and for switch port 0,
@@ -149,8 +152,6 @@  static int link_mgr_set_physp_pi(osm_sm_t * sm, IN osm_physp_t * p_physp,
 			goto Exit;
 		}
 
-		physp0 = osm_node_get_physp_ptr(p_physp->p_node, 0);
-
 		if (ib_switch_info_is_enhanced_port0(&p_node->sw->switch_info)
 		    == FALSE) {
 
@@ -193,7 +194,7 @@  static int link_mgr_set_physp_pi(osm_sm_t * sm, IN osm_physp_t * p_physp,
 	ib_port_info_set_port_state(p_pi, port_state);
 
 	/* Determine ports' M_Key */
-	if (osm_node_get_type(p_physp->p_node) == IB_NODE_TYPE_SWITCH &&
+	if (osm_node_get_type(p_node) == IB_NODE_TYPE_SWITCH &&
 	    osm_physp_get_port_num(p_physp) != 0)
 		m_key = ib_port_info_get_m_key(&physp0->port_info);
 	else