Skip to contentSkip to conversation

block: Remove redundant initialization of variable ret

PATCH Applied Colin Ian King 2 participants 2 messages Nov 26, 2021 – Nov 27, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 block: Remove redundant initialization of variable ret

The variable ret is being initialized with a value that is never read, it is being updated later on. The assignment is redundant and can be removed.

---
 block/bdev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
block/bdev.c +1 -1
index 886a08a045a6..26eefa5de6ca 100644
@@ -665,7 +665,7 @@ static void blkdev_flush_mapping(struct block_device *bdev)
 static int blkdev_get_whole(struct block_device *bdev, fmode_t mode)
 {
 	struct gendisk *disk = bdev->bd_disk;
-	int ret = 0;
+	int ret;
 
 	if (disk->fops->open) {
 		ret = disk->fops->open(bdev, mode);
Signature · 1 line
2.33.1
maintainer Applied
#1 lore raw
Quoted 5 lines · Colin Ian King

The variable ret is being initialized with a value that is never read, it is being updated later on. The assignment is redundant and can be removed.

Applied, thanks!

[1/1] block: Remove redundant initialization of variable ret

      commit: a77f46727daa3febf99663ab1a43c86cf3c2b957

Best regards,

Signature · 1 line
Jens Axboe