IB/qib: Avoid variable-length array
authorRalph Campbell <ralph.campbell@qlogic.com>
Thu, 3 Jun 2010 00:21:07 +0000 (00:21 +0000)
committerRoland Dreier <rolandd@cisco.com>
Mon, 19 Jul 2010 20:21:24 +0000 (13:21 -0700)
Rather than use a variable size array allocation on the stack,
define a constant for the maximum array size possible.

Signed-off-by: Ralph Campbell <ralph.campbell@qlogic.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
drivers/infiniband/hw/qib/qib.h
drivers/infiniband/hw/qib/qib_tx.c

index 3593983df7bafc657c26f19635bf50edf49c4cd9..e67dba40d52eca29ccec805704f06d55d22eaaf2 100644 (file)
@@ -326,6 +326,9 @@ struct qib_verbs_txreq {
 
 #define QIB_DEFAULT_MTU 4096
 
+/* max number of IB ports supported per HCA */
+#define QIB_MAX_IB_PORTS 2
+
 /*
  * Possible IB config parameters for f_get/set_ib_table()
  */
index af30232b68311e73144c609fa556c4e6e64e3059..7f36454c225e5a4ca1f9d35c99d6ba67730354f8 100644 (file)
@@ -170,7 +170,7 @@ static int find_ctxt(struct qib_devdata *dd, unsigned bufn)
 void qib_disarm_piobufs_set(struct qib_devdata *dd, unsigned long *mask,
                            unsigned cnt)
 {
-       struct qib_pportdata *ppd, *pppd[dd->num_pports];
+       struct qib_pportdata *ppd, *pppd[QIB_MAX_IB_PORTS];
        unsigned i;
        unsigned long flags;