Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752443AbdHASAV (ORCPT ); Tue, 1 Aug 2017 14:00:21 -0400 Received: from mga14.intel.com ([192.55.52.115]:58357 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752427AbdHASAT (ORCPT ); Tue, 1 Aug 2017 14:00:19 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.41,306,1498546800"; d="scan'208";a="885168358" Date: Tue, 1 Aug 2017 12:00:17 -0600 From: Ross Zwisler To: Arnd Bergmann Cc: Ross Zwisler , Andrew Morton , Dan Williams , Christoph Hellwig , Vishal Verma , Toshi Kani , Johannes Thumshirn , linux-nvdimm@lists.01.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] nvdimm: avoid bogus -Wmaybe-uninitialized warning Message-ID: <20170801180017.GC20061@linux.intel.com> References: <20170801114926.1171418-1-arnd@arndb.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170801114926.1171418-1-arnd@arndb.de> User-Agent: Mutt/1.8.3 (2017-05-23) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1760 Lines: 35 On Tue, Aug 01, 2017 at 01:48:48PM +0200, Arnd Bergmann wrote: > Removing the btt_rw_page/pmem_rw_page functions had a surprising > side-effect of introducing a false-positive warning in another > function, due to changed inlining decisions in gcc: > > In file included from drivers/nvdimm/pmem.c:36:0: > drivers/nvdimm/pmem.c: In function 'pmem_make_request': > drivers/nvdimm/nd.h:407:2: error: 'start' may be used uninitialized in this function [-Werror=maybe-uninitialized] > drivers/nvdimm/pmem.c:174:16: note: 'start' was declared here > In file included from drivers/nvdimm/btt.c:27:0: > drivers/nvdimm/btt.c: In function 'btt_make_request': > drivers/nvdimm/nd.h:407:2: error: 'start' may be used uninitialized in this function [-Werror=maybe-uninitialized] > drivers/nvdimm/btt.c:1202:16: note: 'start' was declared here > > The problem is that gcc fails to track the value of the 'do_acct' > variable here and has to read it back from stack, but it does > remember that 'start' may be uninitialized sometimes. > > This shuts up the warning by making nd_iostat_start() always > initialize the 'start' variable. In those cases that gcc successfully > tracks the state of the variable, this will have no effect. > > Fixes: 503a5e89b1de ("drivers/nvdimm/btt.c: remove btt_rw_page()") > Fixes: 58100d6e735e ("drivers/nvdimm/pmem.c: remove pmem_rw_page()") > Signed-off-by: Arnd Bergmann This change looks fine: Reviewed-by: Ross Zwisler I believe the patches removing the btt_rw_page() and btt_rw_page() are on hold until I can get some performance numbers to justify them. Dan, do you want to take this as is, or do you want me to include it in my larger rw_page() series if/when that gets revived?