Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752997AbdHBKy3 (ORCPT ); Wed, 2 Aug 2017 06:54:29 -0400 Received: from mail-oi0-f66.google.com ([209.85.218.66]:33868 "EHLO mail-oi0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752962AbdHBKy1 (ORCPT ); Wed, 2 Aug 2017 06:54:27 -0400 MIME-Version: 1.0 In-Reply-To: <20170801222347.GF20061@linux.intel.com> References: <20170801114926.1171418-1-arnd@arndb.de> <20170801144534.2a1e1def29e68eb6c83e203c@linux-foundation.org> <20170801222347.GF20061@linux.intel.com> From: Arnd Bergmann Date: Wed, 2 Aug 2017 12:54:25 +0200 X-Google-Sender-Auth: CcYjzMNYW4Xb6cHs38PIOpO-2tM Message-ID: Subject: Re: [PATCH] nvdimm: avoid bogus -Wmaybe-uninitialized warning To: Ross Zwisler Cc: Andrew Morton , Dan Williams , Christoph Hellwig , Vishal Verma , Toshi Kani , Johannes Thumshirn , linux-nvdimm@lists.01.org, Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1530 Lines: 38 On Wed, Aug 2, 2017 at 12:23 AM, Ross Zwisler wrote: > On Tue, Aug 01, 2017 at 02:45:34PM -0700, Andrew Morton wrote: >> On Tue, 1 Aug 2017 13:48:48 +0200 Arnd Bergmann wrote: >> > --- a/drivers/nvdimm/nd.h >> > +++ b/drivers/nvdimm/nd.h >> > @@ -392,8 +392,10 @@ static inline bool nd_iostat_start(struct bio *bio, unsigned long *start) >> > { >> > struct gendisk *disk = bio->bi_bdev->bd_disk; >> > >> > - if (!blk_queue_io_stat(disk->queue)) >> > + if (!blk_queue_io_stat(disk->queue)) { >> > + *start = 0; >> > return false; >> > + } >> > >> > *start = jiffies; >> > generic_start_io_acct(bio_data_dir(bio), >> >> Well that's sad. >> >> The future of btt-remove-btt_rw_page.patch and friends is shrouded in >> mystery, but if we proceed that way then yes, I guess we'll need to >> work around such gcc glitches. >> >> But let's not leave apparently-unneeded code in place without telling >> people why it is in fact needed? > > Maybe it's just cleaner to initialize 'start' in all the callers, so we don't > have a mysterious line and have to remember why it's there / comment it? I considered that but decided that would be worse, since it shuts up more potential warnings about actual uninitialized use of the variable, and is slightly harder for the compiler to optimize away. You also end up having to add a comment in multiple places. Note that Andrew already added a comment when he applied my patch to his mmotm tree. Arnd