[openib-general] [PATCH] Minor cleanup and remove redundant initializations
Krishna Kumar
krkumar at us.ibm.com
Thu Oct 21 14:55:18 PDT 2004
Trivial patch as described above in ib_mad.c (plus moving some variables
into localized loop).
Thanks,
- KK
--- ib_mad.c.org 2004-10-21 14:48:53.000000000 -0700
+++ ib_mad.c 2004-10-21 14:52:31.000000000 -0700
@@ -356,11 +356,8 @@
{
int ret;
struct ib_send_wr *cur_send_wr, *next_send_wr;
- struct ib_send_wr *bad_wr;
- struct ib_mad_send_wr_private *mad_send_wr;
struct ib_mad_agent_private *mad_agent_priv;
struct ib_mad_port_private *port_priv;
- unsigned long flags;
cur_send_wr = send_wr;
/* Validate supplied parameters */
@@ -382,6 +379,10 @@
/* Walk list of send WRs and post each on send list */
cur_send_wr = send_wr;
while (cur_send_wr) {
+ unsigned long flags;
+ struct ib_send_wr *bad_wr;
+ struct ib_mad_send_wr_private *mad_send_wr;
+
next_send_wr = (struct ib_send_wr *)cur_send_wr->next;
/* Allocate MAD send WR tracking structure */
@@ -1472,7 +1473,7 @@
static inline int ib_mad_change_qp_state_to_init(struct ib_qp *qp)
{
int ret;
- struct ib_qp_attr *attr = NULL;
+ struct ib_qp_attr *attr;
int attr_mask;
struct ib_qp_cap qp_cap;
@@ -1508,7 +1509,7 @@
static inline int ib_mad_change_qp_state_to_rtr(struct ib_qp *qp)
{
int ret;
- struct ib_qp_attr *attr = NULL;
+ struct ib_qp_attr *attr;
int attr_mask;
struct ib_qp_cap qp_cap;
@@ -1534,7 +1535,7 @@
static inline int ib_mad_change_qp_state_to_rts(struct ib_qp *qp)
{
int ret;
- struct ib_qp_attr *attr = NULL;
+ struct ib_qp_attr *attr;
int attr_mask;
struct ib_qp_cap qp_cap;
@@ -1561,7 +1562,7 @@
static inline int ib_mad_change_qp_state_to_reset(struct ib_qp *qp)
{
int ret;
- struct ib_qp_attr *attr = NULL;
+ struct ib_qp_attr *attr;
int attr_mask;
struct ib_qp_cap qp_cap;
@@ -1671,8 +1672,6 @@
.addr = 0,
.size = (unsigned long) high_memory - PAGE_OFFSET
};
- struct ib_qp_init_attr qp_init_attr;
- struct ib_qp_cap qp_cap;
struct ib_mad_port_private *port_priv;
unsigned long flags;
@@ -1723,6 +1722,9 @@
}
for (i = 0; i < IB_MAD_QPS_CORE; i++) {
+ struct ib_qp_init_attr qp_init_attr;
+ struct ib_qp_cap qp_cap;
+
memset(&qp_init_attr, 0, sizeof qp_init_attr);
qp_init_attr.send_cq = port_priv->cq;
qp_init_attr.recv_cq = port_priv->cq;
@@ -1743,7 +1745,7 @@
goto error6;
else
goto error7;
- }
+ }
printk(KERN_DEBUG PFX "Created ib_mad QP %d\n",
port_priv->qp[i]->qp_num);
}
More information about the general
mailing list