mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-30 22:26:55 +00:00
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: 6a0cb1bc10
("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>
This commit is contained in:
parent
89d9475610
commit
3c4da75814
1 changed files with 2 additions and 4 deletions
|
@ -80,7 +80,7 @@ int blkdev_report_zones(struct block_device *bdev,
|
||||||
unsigned int i, n, nz;
|
unsigned int i, n, nz;
|
||||||
unsigned int ofst;
|
unsigned int ofst;
|
||||||
void *addr;
|
void *addr;
|
||||||
int ret = 0;
|
int ret;
|
||||||
|
|
||||||
if (!q)
|
if (!q)
|
||||||
return -ENXIO;
|
return -ENXIO;
|
||||||
|
@ -179,14 +179,12 @@ int blkdev_report_zones(struct block_device *bdev,
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
*nr_zones = nz;
|
||||||
out:
|
out:
|
||||||
bio_for_each_segment_all(bv, bio, i)
|
bio_for_each_segment_all(bv, bio, i)
|
||||||
__free_page(bv->bv_page);
|
__free_page(bv->bv_page);
|
||||||
bio_put(bio);
|
bio_put(bio);
|
||||||
|
|
||||||
if (ret == 0)
|
|
||||||
*nr_zones = nz;
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(blkdev_report_zones);
|
EXPORT_SYMBOL_GPL(blkdev_report_zones);
|
||||||
|
|
Loading…
Reference in a new issue