mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] RDMA/cma: silence GCC warning
@ 2013-07-15 11:03 Paul Bolle
  2013-07-15 21:08 ` Hefty, Sean
  0 siblings, 1 reply; 4+ messages in thread
From: Paul Bolle @ 2013-07-15 11:03 UTC (permalink / raw)
  To: Roland Dreier, Sean Hefty, Hal Rosenstock; +Cc: linux-rdma, linux-kernel

Building cma.o triggers this GCC warning:
    drivers/infiniband/core/cma.c: In function ‘rdma_resolve_addr’:
    drivers/infiniband/core/cma.c:465:23: warning: ‘port’ may be used uninitialized in this function [-Wmaybe-uninitialized]
    drivers/infiniband/core/cma.c:426:5: note: ‘port’ was declared here

This is a false positive, as "port" will always be initialized if we're
at "found".

Help GCC by initializing "port" to 0. Since valid port numbers
apparently start at 1, this is an invalid value. That could help in
analyzing the code and tracking down errors.

Signed-off-by: Paul Bolle <pebolle@tiscali.nl>
---
0) Compile tested only.

1) Perhaps a better way to silence GCC is to drop "port" entirely, and
assign to "id_priv->id.port_num" directly. Would that be acceptable?

 drivers/infiniband/core/cma.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c
index f1c279f..c6c0a5f 100644
--- a/drivers/infiniband/core/cma.c
+++ b/drivers/infiniband/core/cma.c
@@ -426,6 +426,7 @@ static int cma_resolve_ib_dev(struct rdma_id_private *id_priv)
 	u8 port, p;
 	int i;
 
+	port = 0; /* silence GCC */
 	cma_dev = NULL;
 	addr = (struct sockaddr_ib *) cma_dst_addr(id_priv);
 	dgid = (union ib_gid *) &addr->sib_addr;
-- 
1.8.1.4


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

end of thread, other threads:[~2013-07-17 18:07 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-07-15 11:03 [PATCH] RDMA/cma: silence GCC warning Paul Bolle
2013-07-15 21:08 ` Hefty, Sean
2013-07-17  8:40   ` [PATCH v2] " Paul Bolle
2013-07-17 18:07     ` Hefty, Sean

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®