From d173b65aa75fe8d97bccf429c001633910d20bfb Mon Sep 17 00:00:00 2001 From: Christoph Hellwig Date: Thu, 8 Apr 2021 21:41:40 +0200 Subject: [PATCH] block: initialize ret in bdev_disk_changed Avoid a potentially initialized variabe in the invalidate case. Fixes: d3c4a43d9291 ("block: refactor blk_drop_partitions") Reported-by: kernel test robot Signed-off-by: Christoph Hellwig Reviewed-by: Chaitanya Kulkarni Reviewed-by: Keith Busch Link: https://lore.kernel.org/r/20210408194140.1816537-1-hch@lst.de Signed-off-by: Jens Axboe --- fs/block_dev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/block_dev.c b/fs/block_dev.c index 594a1be..363015f 100644 --- a/fs/block_dev.c +++ b/fs/block_dev.c @@ -1236,7 +1236,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); -- 2.7.4