[ofa-general] [PATCH TRIVIAL] opensm: remove unneeded run-time check

Sasha Khapyorsky sashak at voltaire.com
Sun May 6 10:41:38 PDT 2007


remove unneeded run-time NULL pointer check (followed free() is not
under this check anyway).

Signed-off-by: Sasha Khapyorsky <sashak at voltaire.com>
---
 osm/opensm/osm_node.c |   20 +++++++++-----------
 1 files changed, 9 insertions(+), 11 deletions(-)

diff --git a/osm/opensm/osm_node.c b/osm/opensm/osm_node.c
index 3f96c16..e725fd5 100644
--- a/osm/opensm/osm_node.c
+++ b/osm/opensm/osm_node.c
@@ -147,20 +147,17 @@ void
 osm_node_destroy(
   IN osm_node_t *p_node )
 {
+  osm_physp_t *p_physp;
   uint16_t i;
 
-  /* Cleanup all PhysPorts */
-  if( p_node != NULL )
+  /*
+    Cleanup all physports 
+  */
+  for( i = 0; i < p_node->physp_tbl_size; i++ )
   {
-    /*
-      Cleanup all physports 
-    */
-    for( i = 0; i < p_node->physp_tbl_size; i++ )
-    {
-      osm_physp_t *p_physp = osm_node_get_physp_ptr( p_node, i );
-      if (p_physp) 
-        osm_physp_destroy( p_physp );
-    }
+    p_physp = osm_node_get_physp_ptr( p_node, i );
+    if (p_physp) 
+      osm_physp_destroy( p_physp );
   }
 }
 
@@ -170,6 +167,7 @@ void
 osm_node_delete(
   IN OUT osm_node_t** const p_node )
 {
+  CL_ASSERT(p_node && *p_node);
   osm_node_destroy( *p_node );
   free( *p_node );
   *p_node = NULL;
-- 
1.5.2.rc2.20.gac2a




More information about the general mailing list