[ofa-general] [PATCH 3/8] clean up iblinkinfo conversion

Ira Weiny weiny2 at llnl.gov
Thu Apr 23 13:30:53 PDT 2009


From: Ira Weiny <weiny2 at llnl.gov>
Date: Thu, 23 Apr 2009 10:57:10 -0700
Subject: [PATCH] clean up iblinkinfo conversion

Clean up a comment
Fix potential bug

Signed-off-by: Ira Weiny <weiny2 at llnl.gov>
---
 infiniband-diags/Makefile.am              |    2 +-
 infiniband-diags/scripts/iblinkinfo.pl.in |    2 +-
 infiniband-diags/src/iblinkinfo.c         |   10 ++++++----
 3 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/infiniband-diags/scripts/iblinkinfo.pl.in b/infiniband-diags/scripts/iblinkinfo.pl.in
index c81570d..0ce33ab 100755
--- a/infiniband-diags/scripts/iblinkinfo.pl.in
+++ b/infiniband-diags/scripts/iblinkinfo.pl.in
@@ -35,6 +35,6 @@
 #
 
 
-# this is not just a wrapper for the C based utility
+# this is now just a wrapper for the C based utility
 $str = join " ", at ARGV;
 exec "@IBSCRIPTPATH@/iblinkinfo $str";
diff --git a/infiniband-diags/src/iblinkinfo.c b/infiniband-diags/src/iblinkinfo.c
index 1e43788..39de7a2 100644
--- a/infiniband-diags/src/iblinkinfo.c
+++ b/infiniband-diags/src/iblinkinfo.c
@@ -121,15 +121,17 @@ print_port(ibnd_node_t *node, ibnd_port_t *port)
 	char width_msg[256];
 	char speed_msg[256];
 	char ext_port_str[256];
-	int iwidth = mad_get_field(port->info, 0, IB_PORT_LINK_WIDTH_ACTIVE_F);
-	int ispeed = mad_get_field(port->info, 0, IB_PORT_LINK_SPEED_ACTIVE_F);
-	int istate = mad_get_field(port->info, 0, IB_PORT_STATE_F);
-	int iphystate = mad_get_field(port->info, 0, IB_PORT_PHYS_STATE_F);
+	int iwidth, ispeed, istate, iphystate;
 	int n = 0;
 
 	if (!port)
 		return;
 
+	iwidth = mad_get_field(port->info, 0, IB_PORT_LINK_WIDTH_ACTIVE_F);
+	ispeed = mad_get_field(port->info, 0, IB_PORT_LINK_SPEED_ACTIVE_F);
+	istate = mad_get_field(port->info, 0, IB_PORT_STATE_F);
+	iphystate = mad_get_field(port->info, 0, IB_PORT_PHYS_STATE_F);
+
 	remote_guid_str[0] = '\0';
 	remote_str[0] = '\0';
 	link_str[0] = '\0';
-- 
1.5.4.5




More information about the general mailing list