Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932402AbdDRHYL (ORCPT ); Tue, 18 Apr 2017 03:24:11 -0400 Received: from mail-pf0-f180.google.com ([209.85.192.180]:35800 "EHLO mail-pf0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932147AbdDRHYH (ORCPT ); Tue, 18 Apr 2017 03:24:07 -0400 From: Greg Thelen To: Leon Romanovsky 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 In-Reply-To: <20170418070219.GA14088@mtr-leonro.local> References: <20170418062135.76698-1-gthelen@google.com> <20170418070219.GA14088@mtr-leonro.local> User-Agent: Notmuch/0.22 (http://notmuchmail.org) Emacs/25.1.91.1 (x86_64-pc-linux-gnu) Date: Tue, 18 Apr 2017 00:24:05 -0700 Message-ID: MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1014 Lines: 27 Leon Romanovsky wrote: > [ Unknown signature status ] > 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 The above is the only mellanox warning I see. So gcc is able to better analyze the other callsites.