From patchwork Fri Oct 21 15:42:33 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 101646 Delivered-To: patch@linaro.org Received: by 10.140.97.247 with SMTP id m110csp1365784qge; Fri, 21 Oct 2016 08:43:14 -0700 (PDT) X-Received: by 10.99.125.16 with SMTP id y16mr2307045pgc.38.1477064594211; Fri, 21 Oct 2016 08:43:14 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f71si3214889pgc.31.2016.10.21.08.43.13; Fri, 21 Oct 2016 08:43:14 -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 S935131AbcJUPnF (ORCPT + 27 others); Fri, 21 Oct 2016 11:43:05 -0400 Received: from mout.kundenserver.de ([212.227.126.131]:60328 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934350AbcJUPnB (ORCPT ); Fri, 21 Oct 2016 11:43:01 -0400 Received: from wuerfel.lan. ([78.43.20.153]) by mrelayeu.kundenserver.de (mreue004) with ESMTPA (Nemesis) id 0MBo5j-1c7C4X0qkp-00Aj1p; Fri, 21 Oct 2016 17:42:46 +0200 From: Arnd Bergmann To: Jens Axboe Cc: Arnd Bergmann , Shaun Tancheff , "Martin K. Petersen" , Damien Le Moal , Hannes Reinecke , linux-block@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] block: zoned: fix harmless maybe-uninitialized warning Date: Fri, 21 Oct 2016 17:42:33 +0200 Message-Id: <20161021154242.3707589-1-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 X-Provags-ID: V03:K0:JCoj11q7s8NKZhiCe4bC6PwVwoV1BGlof8snhlfxBpxRBS43+Vr +Gx3st47jsIFSab5m+L53MoCzQSi33/d3uTQwV/nraqx309A4S6tnGxdzoGc19VochvQgLe oT93vm/itqc1vq9FmOvxctYDcp38C+nq66fM28BlXgKLMixMZPWwHyz8s4aGVdgdh5bK1xy iPWBk756Eb/QruRyUxzbw== X-UI-Out-Filterresults: notjunk:1; V01:K0:LCSa1QkcJHw=:bniWPoML9FIMLuoBqQJTkL lzU5VObTlNPWoE+RFLJrlFmh4/TUUIbE+e3GPXnjOGw+EZEC6f2Sh78tgwzlPak5LJILNLUz9 rhy/MYT8c/5npqp/OFIpGs4U/4bCGRYl284Us+7mACCfwTUK04aY41q0b6wlpHPO61XCqVxY4 gGt8rCRgwppA+m1lckYd5Pux9hA/CJh3xT3Wxj40iXSPmDT8Q0n5qGHj5BoDcal/iNZakZNP0 f9pFNHb2tU3OkjCMQTIE9aD/cK+UXR8iE8/MMDuNu4BglZN14WmrPyesVIj/j5iGYsK72wnwi /UUzcIBGoinqVdDppcNGMf2fu01G0XG/xkxuWFFzyOUsNaLZX9JH75uYvSHCQQQvfAFjvSfgY eBWCHspxZTfR3FNJBHJBWfP+o1w8LuWrlCgEqwRM1rjtyrbss4RvwSJ4C0o94gYvSRRQEbLpf juH/2/6rwbeGaZ8bx9JLvl5JmSvX50+vaGBAsRpnkaP//qK2EbdThyp459h+dfSPFWerOHgg/ VeSJfwbh41Ect5js2LdZ7CYrKjpjyUX1nWH/mPtY6Ks7sKAtAkA6sSlv4f+fWSWw0EP7noeXw GGKhGcwMtYdnLPTJcyO4G48mH6npSDUm6EvxiwI6IcHLx9sCIWR8pdun9nGUDmafbq5jszcUY 5qin+BUhzed9ek7lqbNXmZekn989m2gBUsrau8miUcu+zK6AeYItB/qK4L+etA0BQ6f4= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The blkdev_report_zones produces a harmless warning when -Wmaybe-uninitialized is set, after gcc gets a little confused about the multiple 'goto' here: block/blk-zoned.c: In function 'blkdev_report_zones': block/blk-zoned.c:188:13: error: 'nz' may be used uninitialized in this function [-Werror=maybe-uninitialized] Moving the assignment to nr_zones makes this a little simpler while also avoiding the warning reliably. I'm removing the extraneous initialization of 'int ret' in the same patch, as that is semi-related and could cause an uninitialized use of that variable to not produce a warning. Fixes: 6a0cb1bc106f ("block: Implement support for zoned block devices") Signed-off-by: Arnd Bergmann --- block/blk-zoned.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) -- 2.9.0 diff --git a/block/blk-zoned.c b/block/blk-zoned.c index 667f95d86695..472211fa183a 100644 --- a/block/blk-zoned.c +++ b/block/blk-zoned.c @@ -80,7 +80,7 @@ int blkdev_report_zones(struct block_device *bdev, unsigned int i, n, nz; unsigned int ofst; void *addr; - int ret = 0; + int ret; if (!q) return -ENXIO; @@ -179,14 +179,12 @@ int blkdev_report_zones(struct block_device *bdev, } + *nr_zones = nz; out: bio_for_each_segment_all(bv, bio, i) __free_page(bv->bv_page); bio_put(bio); - if (ret == 0) - *nr_zones = nz; - return ret; } EXPORT_SYMBOL_GPL(blkdev_report_zones);