From patchwork Tue Aug 1 11:48:48 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 109138 Delivered-To: patch@linaro.org Received: by 10.140.101.6 with SMTP id t6csp1393998qge; Tue, 1 Aug 2017 04:50:48 -0700 (PDT) X-Received: by 10.98.215.85 with SMTP id v21mr367155pfl.222.1501588248524; Tue, 01 Aug 2017 04:50:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1501588248; cv=none; d=google.com; s=arc-20160816; b=KTsp9wfV3D6AKJe0FWW3ft7rq/Rm/3siiLVl2CXQpFa0hPRY3Stbkji8mz+gRHpvH8 z9Z2frz1iFv5juPWPepklH0xlTM/J0J78wMEPn6SRnw1nOIaqE7B1aZLJnPXV9XeSgGg pzamde6Cv9lO4wqQSCIsjDrmTEedhsDCT/4hCwKyCg0cy2j6b8d4RrBi+tJA2gS/pMtJ bcRRXf1WY3RDGeL669CiYJzNwn908b/lehME+lnXWDJlF7wxmsvjMvKiEKScTvRmqRwP TcIkMvzs9UbLp4Vl1Dhb4Znev5agcwZiojjGjUhXqLwc/lv3kF2Ilb45dMznjR4RjqFI rg8g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=LDRNRkfSIoygCniLnj0BiCyXC/MtC/egdJXghSZ44AQ=; b=shm4cpJcI/mDwOPQfTrW131cpYUnV9LxRUDUK2v9XVyj1voGydFA9QXsW4NforQ2Cr iq90H4UVGNU0aUSC0+PqGgup7InTSICqJ3uKk6QxeBsWMk3z65YQ/CbCRkS+Al9OBS7j Y72mS6FRgTIXa1qbnLfD+8fuVnxsSRWPg60VJC4s3uksEna0ceJ0zI/RTOQYK7U+t/U4 BzqQhm+UNkMukRiIOEDikI6Siwk4GSGVJPcYQKifS4JpDfl+Jz4LSfA5EEd+fGgoF6ex 6iE24YYOzxTxuHFI0kvEoBEa1xt71knWXfhThkXMnZXiurkFGN+98BDAopF5KtIcXs7v w6HA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a186si17820981pfb.402.2017.08.01.04.50.48; Tue, 01 Aug 2017 04:50:48 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752016AbdHALuq (ORCPT + 26 others); Tue, 1 Aug 2017 07:50:46 -0400 Received: from mout.kundenserver.de ([212.227.126.134]:58262 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751368AbdHALuo (ORCPT ); Tue, 1 Aug 2017 07:50:44 -0400 Received: from wuerfel.lan ([78.43.238.10]) by mrelayeu.kundenserver.de (mreue004 [212.227.15.129]) with ESMTPA (Nemesis) id 0LtBsd-1dWl8b1SEV-012qQd; Tue, 01 Aug 2017 13:49:30 +0200 From: Arnd Bergmann To: Ross Zwisler , Andrew Morton , Dan Williams Cc: Christoph Hellwig , Arnd Bergmann , Vishal Verma , Toshi Kani , Johannes Thumshirn , linux-nvdimm@lists.01.org, linux-kernel@vger.kernel.org Subject: [PATCH] nvdimm: avoid bogus -Wmaybe-uninitialized warning Date: Tue, 1 Aug 2017 13:48:48 +0200 Message-Id: <20170801114926.1171418-1-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 X-Provags-ID: V03:K0:NjYF2f4EZNvGf+qOG3PmLJNIe2epZwhM05PjoJ5rzYfFxjvqvOS vWH3uGIfXobvfFL9/u6RiIIrnb8bMvPYlSmzJf4EmnfOOXXgiHQYKevwTyNfiBRI7/DlC86 ITYbG3D2gPraBZ5t93YQbtZQrqanZf5bYNuXFjaNpgObEHk9FyELRx36IE+pJ8Yv4TLZr2G aVaaA48T4kS51FyQMYfdQ== X-UI-Out-Filterresults: notjunk:1; V01:K0:JnNpq32LAt4=:KrQHbzU8qGqLiSVUWFFt2X 4eHzys45T+D82g5HldyCNjZo1qGv2KGZEeKGoFAf9DL1l5JK3mE2ZTRVwkpSKOCxXb9ptCdU9 2sy8yU0PfHfVpkh/zEdqaSUllGt3mtWVkXubP6VYzAxdJL9398WwgJapT5ESaxwED/lxiUvoM +RDqAJYABm2cMWw5TFropqYlYMqk1Ibilp+NiqOHEGxx+Vtg0nql7lsrszHkSCDVzXtyV5Vu/ doCt+lVVLFXz9+YzY0B9aNko3W+aYvQCl7UXSCHmJpluucbmBGWjpldlaGXoFJKMvuAKGP9ws EnEMqSczcmCxNfUhSBZF2xqbg7259hGYWsJeSmlfTcrxn+RoZzyK30ows6xaWYBieWAE1idYB qof5lST0p2CZzrteYLsCo++2ESG4YdOil5aDSso/hKVCxuqZr9e+29LBbOk7FzVeomIY0Buip nZj0Z/PN/JGiXfYuqXl2GVEA0fB2NR28d8VaYTAat+Dn/R7RxX9civep1t0zA1wzybRVqXfnt qqlH0C7mjPMt59NRpyXxLzlW79lbmm35MZXUHM9nLFHDbqRrskamVdDWXVFeCJI5PVDmFj7gS QwaR36qskjWUWLRiHVA2GkofYCGM5Qxr33TLi6RnkTSsvFIV5/MWPaWzqcMfsjc8zK0BoFxnz cyRGgIGAluQokV7lzqxo7p7R4kXYl6oHiUtAebUWttym67q6UPFv1aTTOizONop6PCwrELgDx VskjjRj5lse/RioGlGtYoD6zK+GBcteuAoE2Ig== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- drivers/nvdimm/nd.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) -- 2.9.0 Reviewed-by: Ross Zwisler diff --git a/drivers/nvdimm/nd.h b/drivers/nvdimm/nd.h index e1b5715bd91f..64f79a156456 100644 --- 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),