Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755550AbcJUUqo (ORCPT ); Fri, 21 Oct 2016 16:46:44 -0400 Received: from mx0b-00003501.pphosted.com ([67.231.152.68]:32997 "EHLO mx0a-000cda01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1755056AbcJUUqi (ORCPT ); Fri, 21 Oct 2016 16:46:38 -0400 Authentication-Results: seagate.com; dkim=pass header.s="google" header.d=seagate.com MIME-Version: 1.0 In-Reply-To: <20161021154242.3707589-1-arnd@arndb.de> References: <20161021154242.3707589-1-arnd@arndb.de> From: Shaun Tancheff Date: Fri, 21 Oct 2016 15:46:15 -0500 Message-ID: Subject: Re: [PATCH] block: zoned: fix harmless maybe-uninitialized warning To: Arnd Bergmann Cc: Jens Axboe , Shaun Tancheff , "Martin K. Petersen" , Damien Le Moal , Hannes Reinecke , linux-block@vger.kernel.org, LKML Content-Type: text/plain; charset=UTF-8 X-Proofpoint-PolicyRoute: Outbound X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2016-10-21_12:,, signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=21 phishscore=0 bulkscore=0 spamscore=0 clxscore=1011 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1609300000 definitions=main-1610210368 X-Proofpoint-Spam-Policy: Default Domain Policy Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by mail.home.local id u9LKl60L005441 Content-Length: 2200 Lines: 63 On Fri, Oct 21, 2016 at 10:42 AM, Arnd Bergmann wrote: > 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 Reviewed-by: Shaun Tancheff > -- > To unsubscribe from this list: send the line "unsubscribe linux-block" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at https://urldefense.proofpoint.com/v2/url?u=http-3A__vger.kernel.org_majordomo-2Dinfo.html&d=DQIBAg&c=IGDlg0lD0b-nebmJJ0Kp8A&r=Wg5NqlNlVTT7Ugl8V50qIHLe856QW0qfG3WVYGOrWzA&m=RyRS1pzTGdFENUb0PbQRSMAhvMgZx_dBftw2khYVIXU&s=p9SYS2a__p_YHv8FoZVz9kuTQQ7LIZBVKCkZuQgR0cs&e= -- Shaun Tancheff