Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935129AbcJUPnF (ORCPT ); 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 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 List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1425 Lines: 50 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(-) 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); -- 2.9.0