[openib-general] RE: [PATCH] [TRIVIAL] osm_node_info_rcv.c:osm_ni_rcv_init Move assert before variable used

Yael Kalka yael at mellanox.co.il
Wed Nov 30 03:55:25 PST 2005


Good catch... 

-----Original Message-----
From: Hal Rosenstock [mailto:halr at voltaire.com]
Sent: Tuesday, November 29, 2005 5:12 PM
To: Yael Kalka
Cc: openib-general at openib.org; Eitan Zahavi
Subject: [PATCH] [TRIVIAL] osm_node_info_rcv.c:osm_ni_rcv_init Move
assert before variable used


osm_node_info_rcv.c:osm_ni_rcv_init Move assert before the variable is
used

[I think there are numerous instances of this if OpenSM were to be
inspected for this. This could cause issues with --enable-debug (which
have been seen but it is unclear to me whether this is the cause or the
effect). Should more of this be done ?]

Some other cosmetic changes

Signed-off-by: Hal Rosenstock <halr at voltaire.com>

Index: osm_node_info_rcv.c
===================================================================
--- osm_node_info_rcv.c	(revision 4205)
+++ osm_node_info_rcv.c	(working copy)
@@ -986,6 +986,7 @@ osm_ni_rcv_init(
   IN cl_plock_t* const p_lock )
 {
   ib_api_status_t status = IB_SUCCESS;
+
   OSM_LOG_ENTER( p_log, osm_ni_rcv_init );
 
   osm_ni_rcv_construct( p_rcv );
@@ -1013,12 +1014,12 @@ osm_ni_rcv_process(
   osm_node_t *p_node;
   boolean_t  process_new_flag = FALSE;
 
+  CL_ASSERT( p_rcv );
+
   OSM_LOG_ENTER( p_rcv->p_log, osm_ni_rcv_process );
 
-  CL_ASSERT( p_rcv );
   CL_ASSERT( p_madw );
 
-  p_guid_tbl = &p_rcv->p_subn->node_guid_tbl;
   p_smp = osm_madw_get_smp_ptr( p_madw );
   p_ni = (ib_node_info_t*)ib_smp_get_payload_ptr( p_smp );
 
@@ -1041,6 +1042,9 @@ osm_ni_rcv_process(
     osm_dump_smp_dr_path(p_rcv->p_log, p_smp, OSM_LOG_ERROR);
     goto Exit;
   }
+
+  p_guid_tbl = &p_rcv->p_subn->node_guid_tbl;
+
   /*
     Determine if this node has already been discovered,
     and process accordingly.




More information about the general mailing list