aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArnd Bergmann <arnd@arndb.de>2016-10-21 11:42:33 -0400
committerJens Axboe <axboe@fb.com>2016-10-24 22:51:22 -0400
commit3c4da75814c4b8871116940eb32d3a5243026918 (patch)
tree8d589efd82695f294ed859c5ac0d802f9c1f2c3f
parent89d9475610771b5e5fe1879075f0fc9ba6e3755f (diff)
block: zoned: fix harmless maybe-uninitialized warning
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 <arnd@arndb.de> Reviewed-by: Shaun Tancheff <shaun.tancheff@seagate.com> Reviewed-by: Damien Le Moal <damien.lemoal@wdc.com> Signed-off-by: Jens Axboe <axboe@fb.com>
-rw-r--r--block/blk-zoned.c6
1 files 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,
80 unsigned int i, n, nz; 80 unsigned int i, n, nz;
81 unsigned int ofst; 81 unsigned int ofst;
82 void *addr; 82 void *addr;
83 int ret = 0; 83 int ret;
84 84
85 if (!q) 85 if (!q)
86 return -ENXIO; 86 return -ENXIO;
@@ -179,14 +179,12 @@ int blkdev_report_zones(struct block_device *bdev,
179 179
180 } 180 }
181 181
182 *nr_zones = nz;
182out: 183out:
183 bio_for_each_segment_all(bv, bio, i) 184 bio_for_each_segment_all(bv, bio, i)
184 __free_page(bv->bv_page); 185 __free_page(bv->bv_page);
185 bio_put(bio); 186 bio_put(bio);
186 187
187 if (ret == 0)
188 *nr_zones = nz;
189
190 return ret; 188 return ret;
191} 189}
192EXPORT_SYMBOL_GPL(blkdev_report_zones); 190EXPORT_SYMBOL_GPL(blkdev_report_zones);