[openib-general] [PATCH] OpenSM/ib_types.h: Modify ib_port_info_compute_rate

Hal Rosenstock halr at voltaire.com
Thu Dec 15 06:32:54 PST 2005


OpenSM/ib_types.h: Modify ib_port_info_compute_rate so that gcc version
4.0.0 20050519 (Red Hat 4.0.0-8) doesn't complain when compiling
osm_sa_path_record.c as follows:

osm_sa_path_record.c: In function ‘__osm_pr_rcv_get_path_parms’:
osm_sa_path_record.c:194: warning: control may reach end of non-void function ‘ib_port_info_compute_rate’ being inlined

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

Index: include/iba/ib_types.h
===================================================================
--- include/iba/ib_types.h	(revision 4479)
+++ include/iba/ib_types.h	(working copy)
@@ -4290,59 +4290,76 @@ static inline uint8_t
 ib_port_info_compute_rate(
 	IN		const	ib_port_info_t* const		p_pi )
 {
+  uint8_t rate = 0;
+
   switch (ib_port_info_get_link_speed_active(p_pi))
   {
   case IB_LINK_SPEED_ACTIVE_2_5:
     switch (p_pi->link_width_active)
     {
     case IB_LINK_WIDTH_ACTIVE_1X:
-      return IB_PATH_RECORD_RATE_2_5_GBS;
+      rate = IB_PATH_RECORD_RATE_2_5_GBS;
+      break;
       
     case IB_LINK_WIDTH_ACTIVE_4X:
-      return IB_PATH_RECORD_RATE_10_GBS;
-      
+      rate = IB_PATH_RECORD_RATE_10_GBS;
+      break;
+
     case IB_LINK_WIDTH_ACTIVE_12X:
-      return IB_PATH_RECORD_RATE_30_GBS;
-      
+      rate = IB_PATH_RECORD_RATE_30_GBS;
+      break;
+
     default:
-      return IB_PATH_RECORD_RATE_2_5_GBS;
+      rate = IB_PATH_RECORD_RATE_2_5_GBS;
+      break;
     }
     break;
   case IB_LINK_SPEED_ACTIVE_5:
     switch (p_pi->link_width_active)
     {
     case IB_LINK_WIDTH_ACTIVE_1X:
-      return IB_PATH_RECORD_RATE_5_GBS;
-      
+      rate = IB_PATH_RECORD_RATE_5_GBS;
+      break;
+
     case IB_LINK_WIDTH_ACTIVE_4X:
-      return IB_PATH_RECORD_RATE_20_GBS;
-      
+      rate = IB_PATH_RECORD_RATE_20_GBS;
+      break;
+
     case IB_LINK_WIDTH_ACTIVE_12X:
-      return IB_PATH_RECORD_RATE_60_GBS;
-      
+      rate = IB_PATH_RECORD_RATE_60_GBS;
+      break;
+
     default:
-      return IB_PATH_RECORD_RATE_5_GBS;
+      rate = IB_PATH_RECORD_RATE_5_GBS;
+      break;
     }
     break;
   case IB_LINK_SPEED_ACTIVE_10:
     switch (p_pi->link_width_active)
     {
     case IB_LINK_WIDTH_ACTIVE_1X:
-      return IB_PATH_RECORD_RATE_10_GBS;
-      
+      rate = IB_PATH_RECORD_RATE_10_GBS;
+      break;
+
     case IB_LINK_WIDTH_ACTIVE_4X:
-      return IB_PATH_RECORD_RATE_40_GBS;
-      
+      rate = IB_PATH_RECORD_RATE_40_GBS;
+      break;
+
     case IB_LINK_WIDTH_ACTIVE_12X:
-      return IB_PATH_RECORD_RATE_120_GBS;
-      
+      rate =IB_PATH_RECORD_RATE_120_GBS;
+      break;
+
     default:
-      return IB_PATH_RECORD_RATE_10_GBS;
+      rate = IB_PATH_RECORD_RATE_10_GBS;
+      break;
     }
     break;
   default:
-    return IB_PATH_RECORD_RATE_2_5_GBS;
+    rate = IB_PATH_RECORD_RATE_2_5_GBS;
+    break;
   }
+
+  return rate;
 }
 /*
 * PARAMETERS






More information about the general mailing list