[openib-general] [PATCH] Opensm - opensm/osm_ucast_updn.c

Yael Kalka yael at mellanox.co.il
Sun Feb 12 03:31:13 PST 2006


Hi Hal,

The following patch cleans up the osm_ucast_updn.c construct function
that you pointed out, and also adds a check if the construct succeeded
during updn_init.

Thanks,
Yael

Signed-off-by:  Yael Kalka <yael at mellanox.co.il>

Index: opensm/osm_ucast_updn.c
===================================================================
--- opensm/osm_ucast_updn.c     (revision 5372)
+++ opensm/osm_ucast_updn.c     (working copy)
@@ -495,12 +496,6 @@ updn_construct(void)
   OSM_LOG_ENTER( &(osm.log) , updn_construct);
 
   p_updn = cl_zalloc(sizeof(updn_t));
-  if (p_updn == NULL)
-  {
-    goto Exit;
-  }
-
-  Exit :
     OSM_LOG_EXIT( &(osm.log) );
   return(p_updn);
 }
@@ -519,6 +514,12 @@ updn_init(
   ib_api_status_t status = IB_SUCCESS;
 
   OSM_LOG_ENTER( &(osm.log) , updn_init );
+  /* Make sure the p_updn isn't NULL */
+  if (!p_updn)
+  {
+    status = IB_ERROR;
+    goto Exit_Bad;
+  }
   p_updn->state = UPDN_INIT;
   cl_qmap_init( &p_updn->guid_rank_tbl);
   p_list = (cl_list_t*)cl_malloc(sizeof(cl_list_t));




More information about the general mailing list