diff mbox series

block: initialize ret in bdev_disk_changed

Message ID 20210408194140.1816537-1-hch@lst.de (mailing list archive)
State New, archived
Headers show
Series block: initialize ret in bdev_disk_changed | expand

Commit Message

Christoph Hellwig April 8, 2021, 7:41 p.m. UTC
Avoid a potentially initialized variabe in the invalidate case.

Fixes: d3c4a43d9291 ("block: refactor blk_drop_partitions")
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 fs/block_dev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Chaitanya Kulkarni April 8, 2021, 9:17 p.m. UTC | #1
On 4/8/21 12:44, Christoph Hellwig wrote:
> Avoid a potentially initialized variabe in the invalidate case.
>
> Fixes: d3c4a43d9291 ("block: refactor blk_drop_partitions")
> Reported-by: kernel test robot <lkp@intel.com>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---

Looks good.

Reviewed-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
Keith Busch April 8, 2021, 9:41 p.m. UTC | #2
On Thu, Apr 08, 2021 at 09:41:40PM +0200, Christoph Hellwig wrote:
> Avoid a potentially initialized variabe in the invalidate case.

That should say "uninitialized variable", otherwise looks good.

Reviewed-by: Keith Busch <kbusch@kernel.org>
Jens Axboe April 12, 2021, 12:44 p.m. UTC | #3
On 4/8/21 1:41 PM, Christoph Hellwig wrote:
> Avoid a potentially initialized variabe in the invalidate case.

Applied, thanks.
diff mbox series

Patch

diff --git a/fs/block_dev.c b/fs/block_dev.c
index 594a1bee9dd9ac..363015fcffdbba 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);