diff mbox

osmtest: initialize attr_array[] on declaration

Message ID 20091012213631.GF13830@me (mailing list archive)
State Not Applicable, archived
Headers show

Commit Message

Sasha Khapyorsky Oct. 12, 2009, 9:36 p.m. UTC
None
diff mbox

Patch

diff --git a/opensm/osmtest/main.c b/opensm/osmtest/main.c
index 11bb0c8..4cead91 100644
--- a/opensm/osmtest/main.c
+++ b/opensm/osmtest/main.c
@@ -213,14 +213,9 @@  static void print_all_guids(IN osmtest_t * p_osmt)
 {
 	ib_api_status_t status;
 	uint32_t num_ports = MAX_LOCAL_IBPORTS;
-	ib_port_attr_t attr_array[MAX_LOCAL_IBPORTS];
+	ib_port_attr_t attr_array[MAX_LOCAL_IBPORTS] = { {0} };
 	uint32_t i;
 
-	for (i = 0; i < num_ports; i++) {
-		attr_array[i].num_pkeys = 0;
-		attr_array[i].p_pkey_table = NULL;
-	}
-
 	/*
 	   Call the transport layer for a list of local port
 	   GUID values.
@@ -246,14 +241,9 @@  ib_net64_t get_port_guid(IN osmtest_t * p_osmt, uint64_t port_guid)
 {
 	ib_api_status_t status;
 	uint32_t num_ports = MAX_LOCAL_IBPORTS;
-	ib_port_attr_t attr_array[MAX_LOCAL_IBPORTS];
+	ib_port_attr_t attr_array[MAX_LOCAL_IBPORTS] = { {0} };
 	uint32_t i;
 
-	for (i = 0; i < num_ports; i++) {
-		attr_array[i].num_pkeys = 0;
-		attr_array[i].p_pkey_table = NULL;
-	}
-
 	/*
 	   Call the transport layer for a list of local port
 	   GUID values.
diff --git a/opensm/osmtest/osmtest.c b/opensm/osmtest/osmtest.c
index a1457b8..9dd1117 100644
--- a/opensm/osmtest/osmtest.c
+++ b/opensm/osmtest/osmtest.c
@@ -7236,16 +7236,10 @@  osmtest_bind(IN osmtest_t * p_osmt,
 	uint32_t port_index;
 	ib_api_status_t status;
 	uint32_t num_ports = MAX_LOCAL_IBPORTS;
-	ib_port_attr_t attr_array[MAX_LOCAL_IBPORTS];
-	uint32_t i;
+	ib_port_attr_t attr_array[MAX_LOCAL_IBPORTS] = { {0} };
 
 	OSM_LOG_ENTER(&p_osmt->log);
 
-	for (i = 0; i < num_ports; i++) {
-		attr_array[i].num_pkeys = 0;
-		attr_array[i].p_pkey_table = NULL;
-	}
-
 	/*
 	 * Call the transport layer for a list of local port
 	 * GUID values.