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: 9874325 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 28D156037D for ; Tue, 1 Aug 2017 11:50:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0FEC228683 for ; Tue, 1 Aug 2017 11:50:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0201A2869F; Tue, 1 Aug 2017 11:49:59 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from ml01.01.org (ml01.01.org [198.145.21.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 6FCFB28683 for ; Tue, 1 Aug 2017 11:49:58 +0000 (UTC) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 15755209589FA; Tue, 1 Aug 2017 04:47:49 -0700 (PDT) X-Original-To: linux-nvdimm@lists.01.org Delivered-To: linux-nvdimm@lists.01.org Received: from mout.kundenserver.de (mout.kundenserver.de [212.227.126.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id E2BC6209589F8 for ; Tue, 1 Aug 2017 04:47:47 -0700 (PDT) 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 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== X-BeenThere: linux-nvdimm@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "Linux-nvdimm developer list." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Arnd Bergmann , linux-nvdimm@lists.01.org, linux-kernel@vger.kernel.org, Christoph Hellwig MIME-Version: 1.0 Errors-To: linux-nvdimm-bounces@lists.01.org Sender: "Linux-nvdimm" X-Virus-Scanned: ClamAV using ClamSMTP 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 Reviewed-by: Ross Zwisler --- drivers/nvdimm/nd.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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),