]> git.baikalelectronics.ru Git - kernel.git/commit
block: zoned: fix harmless maybe-uninitialized warning
authorArnd Bergmann <arnd@arndb.de>
Fri, 21 Oct 2016 15:42:33 +0000 (17:42 +0200)
committerJens Axboe <axboe@fb.com>
Tue, 25 Oct 2016 02:51:22 +0000 (20:51 -0600)
commit42e49c1fff254a7412f4e21e7436d761fe236397
tree8d589efd82695f294ed859c5ac0d802f9c1f2c3f
parentfc529d62a9280e05158ea9d6c24c70a0e056b64a
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: 3bf737cfdd56 ("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>
block/blk-zoned.c