Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755169AbdDRHCK (ORCPT ); Tue, 18 Apr 2017 03:02:10 -0400 Received: from mail.kernel.org ([198.145.29.136]:50800 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754217AbdDRHCI (ORCPT ); Tue, 18 Apr 2017 03:02:08 -0400 Date: Tue, 18 Apr 2017 10:02:19 +0300 From: Leon Romanovsky To: Greg Thelen Cc: Or Gerlitz , Jack Morgenstein , Matan Barak , 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, Tariq Toukan Subject: Re: [PATCH] net/mlx4: suppress 'may be used uninitialized' warning Message-ID: <20170418070219.GA14088@mtr-leonro.local> References: <20170418062135.76698-1-gthelen@google.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="y0ulUmNC+osPPQO6" Content-Disposition: inline In-Reply-To: <20170418062135.76698-1-gthelen@google.com> User-Agent: Mutt/1.8.0 (2017-02-23) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1844 Lines: 48 --y0ulUmNC+osPPQO6 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Mon, Apr 17, 2017 at 11:21:35PM -0700, Greg Thelen wrote: > 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 > --- It looks like other callers of mr_res_start_move_to() have the same "uninitialized" variable. Thanks --y0ulUmNC+osPPQO6 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEkhr/r4Op1/04yqaB5GN7iDZyWKcFAlj1ufsACgkQ5GN7iDZy WKcYaBAAqDl2pw2RUohGYSWfNig1z0ncrsIEsfurzBoAiEfgMgA21r6IrO3V1PY4 D7PKZwXVfM8E7pY5Q86FKXZ+9quKi+Lkl9xGD7+isaBLAXcZ1OwElMgP79eThV5H VZqCXS0Nqafe+XN5JMAn/0Egi932S34m2EYlRisJBgVyrFWuQ98RxyAjOKS5NEPo IFo5uDjkpRYv9mtPtG3WCE2bw3it9rPqHjYfrvvmtybD5Cv+vm4SnA1vG//+fA+3 7BTmYvnXhoHFh4GWWaCOZpCsv/u0fySAXP0s8WsYiZMGZTQ3kdEV35ERj1xa5bC6 3UXJvzXPl8Waes0x5T7xjCmMVPk9Tw/C1iVUzlHvSO6D7GdU/vnI7ws50BkQ2xVL c/DG02LE455Nb5XllMGq+sEUI713mci9D7RtNpGJcrwj5Z/w88od1jEPyWYcgEtX 8Tux2XXHunSXgYfBFUJ7L65//iX+L7x2EaNegKlfs7FFONUSX3+FHQjhwnVjLEjR e0gASQreEYvdlCFDb/geW+IompeSE8rEZoQZmXmSBmv8107yfG6dVza4oTO1vBWG hOaLGw39zvpKn9KI7W8+a/nRX67TZYNFK6hYpXpnIuoftic8YM+mGhws7H/Ohc3E 8xz9i9vdtIVnLuna29D0SL/ctGVtPLc2MK2m5b9Rup4erVnwFPk= =ngpP -----END PGP SIGNATURE----- --y0ulUmNC+osPPQO6--