From patchwork Mon Jul 15 11:03:59 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paul Bolle X-Patchwork-Id: 2827403 Return-Path: X-Original-To: patchwork-linux-rdma@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id A49D1C0AB2 for ; Mon, 15 Jul 2013 11:04:07 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7BA8D201F7 for ; Mon, 15 Jul 2013 11:04:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 092C5201F2 for ; Mon, 15 Jul 2013 11:04:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755137Ab3GOLED (ORCPT ); Mon, 15 Jul 2013 07:04:03 -0400 Received: from cpsmtpb-ews08.kpnxchange.com ([213.75.39.13]:63819 "EHLO cpsmtpb-ews08.kpnxchange.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754299Ab3GOLEC (ORCPT ); Mon, 15 Jul 2013 07:04:02 -0400 Received: from cpsps-ews07.kpnxchange.com ([10.94.84.174]) by cpsmtpb-ews08.kpnxchange.com with Microsoft SMTPSVC(7.5.7601.17514); Mon, 15 Jul 2013 13:04:00 +0200 Received: from CPSMTPM-TLF101.kpnxchange.com ([195.121.3.4]) by cpsps-ews07.kpnxchange.com with Microsoft SMTPSVC(7.5.7601.17514); Mon, 15 Jul 2013 13:04:00 +0200 Received: from [192.168.1.103] ([212.123.139.93]) by CPSMTPM-TLF101.kpnxchange.com with Microsoft SMTPSVC(7.5.7601.17514); Mon, 15 Jul 2013 13:03:59 +0200 Message-ID: <1373886239.2591.26.camel@x61.thuisdomein> Subject: [PATCH] RDMA/cma: silence GCC warning From: Paul Bolle To: Roland Dreier , Sean Hefty , Hal Rosenstock Cc: linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org Date: Mon, 15 Jul 2013 13:03:59 +0200 X-Mailer: Evolution 3.6.4 (3.6.4-3.fc18) Mime-Version: 1.0 X-OriginalArrivalTime: 15 Jul 2013 11:03:59.0909 (UTC) FILETIME=[0228ED50:01CE814B] X-RcptDomain: vger.kernel.org Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Spam-Status: No, score=-7.3 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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;