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: 9389543 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 05109607F0 for ; Fri, 21 Oct 2016 15:43:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EB4AA2A0C1 for ; Fri, 21 Oct 2016 15:43:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DFA1F2A152; Fri, 21 Oct 2016 15:43:03 +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=-6.4 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B616F2A0C1 for ; Fri, 21 Oct 2016 15:43:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934420AbcJUPnB (ORCPT ); Fri, 21 Oct 2016 11:43:01 -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-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 Reviewed-by: Shaun Tancheff Reviewed-by: Damien Le Moal --- 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);