mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] IB/lmx4: silence GCC warning
@ 2012-09-28 12:48 Paul Bolle
  2012-10-10  7:23 ` Jack Morgenstein
  0 siblings, 1 reply; 9+ messages in thread
From: Paul Bolle @ 2012-09-28 12:48 UTC (permalink / raw)
  To: Roland Dreier, Sean Hefty, Hal Rosenstock; +Cc: linux-rdma, linux-kernel

Building qp.o (part of the "Mellanox ConnectX HCA support" driver)
triggers this GCC warning:
    drivers/infiniband/hw/mlx4/qp.c: In function ‘mlx4_ib_post_send’:
    drivers/infiniband/hw/mlx4/qp.c:1828:30: warning: ‘vlan’ may be used uninitialized in this function [-Wmaybe-uninitialized]
    drivers/infiniband/hw/mlx4/qp.c:1718:6: note: ‘vlan’ was declared here

Looking at the code it is clear 'vlan' is only set and used if 'is_eth'
is non-zero. But there's no harm in initializing 'vlan' to 0 (which
matches ib_get_cached_gid()'s default return) to silence GCC.

Signed-off-by: Paul Bolle <pebolle@tiscali.nl>
---
0) I noticed this warning while building v3.6-rc7 on current Fedora 17,
using Fedora's default config.

1) Compile tested only. I tested against v3.6-rc7, with commit
a41262bb5721f2b708ee8b23f67be2f2e16a2fab ("IB/mlx4: SR-IOV IB context
objects and proxy/tunnel SQP") from linux-next cherry-picked, to take
into account a trivial context change in linux-next.

 drivers/infiniband/hw/mlx4/qp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/infiniband/hw/mlx4/qp.c b/drivers/infiniband/hw/mlx4/qp.c
index a862251..71fdda6 100644
--- a/drivers/infiniband/hw/mlx4/qp.c
+++ b/drivers/infiniband/hw/mlx4/qp.c
@@ -1715,7 +1715,7 @@ 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 err = 0;
 
 	send_size = 0;
-- 
1.7.11.4


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2013-02-26  7:57 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-09-28 12:48 [PATCH] IB/lmx4: silence GCC warning Paul Bolle
2012-10-10  7:23 ` Jack Morgenstein
2012-10-29  9:50   ` Paul Bolle
2013-02-13 13:50     ` Bart Van Assche
2013-02-21  9:02       ` [PATCH v2] IB/mlx4: " Paul Bolle
2013-02-24 12:34         ` Jack Morgenstein
2013-02-25 16:54           ` Roland Dreier
2013-02-25 17:23             ` Roland Dreier
2013-02-26  7:57               ` Jack Morgenstein

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®