[openib-general] [PATCH] Opensm - Fix bug in cl_event_wheel

Yael Kalka yael at mellanox.co.il
Thu Sep 22 04:45:28 PDT 2005


Hi Hal,

There is a bug in the init function of cl_event_wheel - initializing
of spinlock inside CL_ASSERT.
Attached is a patch to fix it.

Thanks,
Yael

Index: complib/cl_event_wheel.c
===================================================================
--- complib/cl_event_wheel.c	(revision 439)
+++ complib/cl_event_wheel.c	(working copy)
@@ -224,7 +224,14 @@ cl_event_wheel_init(
   p_event_wheel->p_log = p_log;
   p_event_wheel->p_external_lock = NULL;
   p_event_wheel->closing = FALSE;
-  CL_ASSERT( cl_spinlock_init( &(p_event_wheel->lock) ) == CL_SUCCESS );
+  cl_status =  cl_spinlock_init( &(p_event_wheel->lock) );
+  if (cl_status != CL_SUCCESS)
+  {
+    osm_log (p_event_wheel->p_log, OSM_LOG_ERROR,
+             "cl_event_wheel_init : ERROR 1000: "
+             "Failed to initialize cl_spinlock\n" );
+    goto Exit;
+  }
   cl_qlist_init( &p_event_wheel->events_wheel);
   cl_qmap_init( &p_event_wheel->events_map );
 
@@ -237,8 +244,10 @@ cl_event_wheel_init(
   {
     osm_log (p_event_wheel->p_log, OSM_LOG_ERROR,
              "cl_event_wheel_init : ERROR 1000: "
-             "Failed to initialize timer\n" );
+             "Failed to initialize cl_timer\n" );
+    goto Exit;
   }
+ Exit:
   OSM_LOG_EXIT( p_event_wheel->p_log );
   return(cl_status);
 }




More information about the general mailing list