[<prev] [next>] [day] [month] [year] [list]
Message-Id: <1329230877-27457-1-git-send-email-danny.kukawka@bisect.de>
Date: Tue, 14 Feb 2012 15:47:57 +0100
From: Danny Kukawka <danny.kukawka@...ect.de>
To: Roland Dreier <roland@...nel.org>
Cc: Danny Kukawka <dkukawka@...e.de>,
Sean Hefty <sean.hefty@...el.com>,
Hal Rosenstock <hal.rosenstock@...il.com>,
Or Gerlitz <ogerlitz@...lanox.com>,
Oren Duer <oren@...lanox.co.il>, linux-rdma@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: [PATCH v2] mlx4: fix -Wuninitialized warning
Fix for:
drivers/infiniband/hw/mlx4/qp.c: In function ‘build_mlx_header’:
drivers/infiniband/hw/mlx4/qp.c:1441:30: warning: ‘vlan’ may be
used uninitialized in this function [-Wuninitialized]
Initialize vlan with 0. Check return value of ib_get_cached_gid()
and return out of build_mlx_header() in error case.
v2: handle also error cases
Signed-off-by: Danny Kukawka <danny.kukawka@...ect.de>
---
drivers/infiniband/hw/mlx4/qp.c | 18 +++++++++++----
1 files changed, 14 insertions(+), 4 deletions(-)
diff --git a/drivers/infiniband/hw/mlx4/qp.c b/drivers/infiniband/hw/mlx4/qp.c
index aa2aefa..4b889d9 100644
--- a/drivers/infiniband/hw/mlx4/qp.c
+++ b/drivers/infiniband/hw/mlx4/qp.c
@@ -1363,7 +1363,8 @@ static int build_mlx_header(struct mlx4_ib_sqp *sqp, struct ib_send_wr *wr,
int is_eth;
int is_vlan = 0;
int is_grh;
- u16 vlan;
+ u16 vlan = 0;
+ int ret;
send_size = 0;
for (i = 0; i < wr->num_sge; ++i)
@@ -1372,8 +1373,12 @@ static int build_mlx_header(struct mlx4_ib_sqp *sqp, struct ib_send_wr *wr,
is_eth = rdma_port_get_link_layer(sqp->qp.ibqp.device, sqp->qp.port) == IB_LINK_LAYER_ETHERNET;
is_grh = mlx4_ib_ah_grh_present(ah);
if (is_eth) {
- ib_get_cached_gid(ib_dev, be32_to_cpu(ah->av.ib.port_pd) >> 24,
+ ret = ib_get_cached_gid(ib_dev,
+ be32_to_cpu(ah->av.ib.port_pd) >> 24,
ah->av.ib.gid_index, &sgid);
+ if (ret)
+ return ret;
+
vlan = rdma_get_vlan_id(&sgid);
is_vlan = vlan < 0x1000;
}
@@ -1392,8 +1396,13 @@ static int build_mlx_header(struct mlx4_ib_sqp *sqp, struct ib_send_wr *wr,
sqp->ud_header.grh.flow_label =
ah->av.ib.sl_tclass_flowlabel & cpu_to_be32(0xfffff);
sqp->ud_header.grh.hop_limit = ah->av.ib.hop_limit;
- ib_get_cached_gid(ib_dev, be32_to_cpu(ah->av.ib.port_pd) >> 24,
- ah->av.ib.gid_index, &sqp->ud_header.grh.source_gid);
+ ret = ib_get_cached_gid(ib_dev,
+ be32_to_cpu(ah->av.ib.port_pd) >> 24,
+ ah->av.ib.gid_index,
+ &sqp->ud_header.grh.source_gid);
+ if (ret)
+ return ret;
+
memcpy(sqp->ud_header.grh.destination_gid.raw,
ah->av.ib.dgid, 16);
}
--
1.7.7.3
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists