Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S971560AbdDTRTx (ORCPT ); Thu, 20 Apr 2017 13:19:53 -0400 Received: from shards.monkeyblade.net ([184.105.139.130]:45630 "EHLO shards.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S944127AbdDTRTv (ORCPT ); Thu, 20 Apr 2017 13:19:51 -0400 Date: Thu, 20 Apr 2017 13:19:49 -0400 (EDT) Message-Id: <20170420.131949.157388310132608724.davem@davemloft.net> To: gthelen@google.com Cc: ogerlitz@mellanox.com, jackm@dev.mellanox.co.il, matanb@mellanox.com, idos@mellanox.com, yishaih@mellanox.com, amirv@mellanox.com, roland@purestorage.com, netdev@vger.kernel.org, linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] net/mlx4: suppress 'may be used uninitialized' warning From: David Miller In-Reply-To: <20170418062135.76698-1-gthelen@google.com> References: <20170418062135.76698-1-gthelen@google.com> X-Mailer: Mew version 6.7 on Emacs 24.5 / Mule 6.0 (HANACHIRUSATO) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.5.12 (shards.monkeyblade.net [149.20.54.216]); Thu, 20 Apr 2017 09:38:28 -0700 (PDT) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 745 Lines: 18 From: Greg Thelen Date: Mon, 17 Apr 2017 23:21:35 -0700 > 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 Appied to net-next.