diff mbox

[opensm] osm_ucast_ftree.c: replace assert with error return value

Message ID 52C16610.4080402@dev.mellanox.co.il (mailing list archive)
State Accepted
Delegated to: Hal Rosenstock
Headers show

Commit Message

Hal Rosenstock Dec. 30, 2013, 12:24 p.m. UTC
From: Daniel Klein <danielk@mellanox.com>

Removed assert in fabric_create_leaf_switch_array() that checks that the
number of leafs is > 1. Instead the function returns -1, which fails the
routing engine.

Signed-off-by: Daniel Klein <danielk@mellanox.com>
Signed-off-by: Hal Rosenstock <hal@mellanox.com>
---
 opensm/osm_ucast_ftree.c |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)
diff mbox

Patch

diff --git a/opensm/osm_ucast_ftree.c b/opensm/osm_ucast_ftree.c
index 581c233..4cec0ae 100644
--- a/opensm/osm_ucast_ftree.c
+++ b/opensm/osm_ucast_ftree.c
@@ -1719,12 +1719,19 @@  static int fabric_create_leaf_switch_array(IN ftree_fabric_t * p_ftree)
 			last_leaf_idx = i;
 		}
 	}
-	CL_ASSERT(first_leaf_idx < last_leaf_idx);
 
 	OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_DEBUG,
 		"Full leaf array info: first_leaf_idx = %u, last_leaf_idx = %u\n",
 		first_leaf_idx, last_leaf_idx);
 
+	if (first_leaf_idx >= last_leaf_idx) {
+		osm_log_v2(&p_ftree->p_osm->log, OSM_LOG_INFO, FILE_ID,
+			   "Faild to find leaf switches - topology is not "
+			   "fat-tree\n");
+		res = -1;
+		goto Exit;
+	}
+
 	/* Create array of REAL leaf switches, sorted by index.
 	   This array may contain switches at the same rank w/o CNs,
 	   in case this is the order of indexing. */