From patchwork Tue Apr 18 06:21:35 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Thelen X-Patchwork-Id: 9684985 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 3D71F602C2 for ; Tue, 18 Apr 2017 06:21:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2D81E27D4D for ; Tue, 18 Apr 2017 06:21:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1FB232835B; Tue, 18 Apr 2017 06:21:52 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C505E27D4D for ; Tue, 18 Apr 2017 06:21:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753314AbdDRGVu (ORCPT ); Tue, 18 Apr 2017 02:21:50 -0400 Received: from mail-pg0-f54.google.com ([74.125.83.54]:36484 "EHLO mail-pg0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751708AbdDRGVt (ORCPT ); Tue, 18 Apr 2017 02:21:49 -0400 Received: by mail-pg0-f54.google.com with SMTP id g2so82617874pge.3 for ; Mon, 17 Apr 2017 23:21:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=4WG2vqDFDrVPTuqA62EywGBcB6n9dp/k1ZVijyI5X3I=; b=uWLqIbgZBphP79NA+LUBMQb9v2Xd3uGTTAc2oNhjsXu9DsvUHdl7G6Ys7Fu61hVO1o PEFW9X11kOz4n5OomYle4ifqX0DTT9Ho2KRE5pBiEtmcU6kR80AO/eIvWQIWNH/4932R 45A3IT/2nJ0Wq9s5dTWpaGHpxFqT49H3jpZD/8QniMmWokDKD+gf+5RqdrWs8+qLzdX7 IpUzYkQGmyJrNzCO8JUi5mnhkliNPFXZL1JAkMfkURE1aBpyqiLuITWmnHs+XgomVzrj gQBJ5LvNXogd4hcUQ3keMxfUsoF7zd8p6VJH7g8lUydd+DZieoXuNjOjHSHW42w7eppp hU4A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=4WG2vqDFDrVPTuqA62EywGBcB6n9dp/k1ZVijyI5X3I=; b=DUPuSfeie7Nkj21MWxMuuvtsECgtLL4Z9s/Re41eUQr+lyjyt+XF6/r3783QK5ptqV fNXFD4q+sVKM+d0cESi+aoVGowFJzIhoCebDGrJh39K0iTfwdxqUzttAXxOt0g4J2zYg nPuZZr38RQzVvz/Ef2CWoNrgjBzuDYKe2HrSPxhnVAQ7f9NgYrIQT/l95akINBJ2qK1R j46be2CEX09+TkReAbo1UKV2atuIGdCnshlwGmjiM7+vHn3YMWOFgxUyBcGIE+eG7spM AElwFoBWqBTICdfrJB6ZyZ5TVfDtHjjfykZ7PT6BOsgj0O0r1Dil+78KN6JaKuEiwBav 90SA== X-Gm-Message-State: AN3rC/4/bde+P2unN6KNjaEQwy8HjZHk7oHsh4ebWR0OjAWUA9CgGVjH NxkXVtvxYo2gawgg X-Received: by 10.98.131.67 with SMTP id h64mr15368729pfe.61.1492496508065; Mon, 17 Apr 2017 23:21:48 -0700 (PDT) Received: from gthelen.mtv.corp.google.com ([100.99.140.58]) by smtp.gmail.com with ESMTPSA id y78sm1184548pff.107.2017.04.17.23.21.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 17 Apr 2017 23:21:47 -0700 (PDT) From: Greg Thelen To: Or Gerlitz , Jack Morgenstein , Matan Barak Cc: Ido Shamay , Yishai Hadas , Amir Vadai , Roland Dreier , "David S. Miller" , netdev@vger.kernel.org, linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org, Greg Thelen Subject: [PATCH] net/mlx4: suppress 'may be used uninitialized' warning Date: Mon, 17 Apr 2017 23:21:35 -0700 Message-Id: <20170418062135.76698-1-gthelen@google.com> X-Mailer: git-send-email 2.12.2.762.g0e3151a226-goog Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP gcc 4.8.4 complains that mlx4_SW2HW_MPT_wrapper() uses an uninitialized 'mpt' variable: drivers/net/ethernet/mellanox/mlx4/resource_tracker.c: In function 'mlx4_SW2HW_MPT_wrapper': drivers/net/ethernet/mellanox/mlx4/resource_tracker.c:2802:12: warning: 'mpt' may be used uninitialized in this function [-Wmaybe-uninitialized] mpt->mtt = mtt; I think this warning is a false complaint. mpt is only used when mr_res_start_move_to() return zero, and in all such cases it initializes mpt. But apparently gcc cannot see that. Initialize mpt to avoid the warning. Signed-off-by: Greg Thelen --- drivers/net/ethernet/mellanox/mlx4/resource_tracker.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c b/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c index d8d5d161b8c7..4aa29ee93013 100644 --- a/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c +++ b/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c @@ -2749,7 +2749,7 @@ int mlx4_SW2HW_MPT_wrapper(struct mlx4_dev *dev, int slave, int err; int index = vhcr->in_modifier; struct res_mtt *mtt; - struct res_mpt *mpt; + struct res_mpt *mpt = NULL; int mtt_base = mr_get_mtt_addr(inbox->buf) / dev->caps.mtt_entry_sz; int phys; int id;