block: initialize variable ret with 0
Subsystems (3)
PATCH 1/1 block: initialize variable ret with 0
ret variable is not being set if get_capacity returns 0 in very first try. It should be initialized with 0 for this case.
Addresses-Coverity: ("Uninitialized variable")
Fixes d3c4a43d92 ("block: refactor blk_drop_partitions")
Signed-off-by Muhammad Usama Anjum <[email protected]>
--- fs/block_dev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/block_dev.c +1 -1
@@ -1240,7 +1240,7 @@ static void __blkdev_put(struct block_device *bdev, fmode_t mode, int for_part);int bdev_disk_changed (struct block_device *bdev,bool invalidate) {struct gendisk *disk = bdev->bd_disk; -int ret; +int ret =0 ;lockdep_assert_held (&bdev->bd_mutex);
Signature · 1 line
2.25.1