Skip to contentSkip to conversation

blk-zoned: Remove unnecessary ‘0’ values from ret

PATCH In review Li zeming 3 participants 3 messages Mar 18, 2024 – May 28, 2024

Subsystems (2)
lore
Share & tools
lore

Li zeming

author
#0 lore raw

PATCH 1/1 blk-zoned: Remove unnecessary ‘0’ values from ret

ret is assigned first, so it does not need to initialize the assignment.

---
 block/blk-zoned.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
block/blk-zoned.c +1 -1
index d343e5756a9c8..6633e95bc7858 100644
@@ -255,7 +255,7 @@ int blkdev_zone_mgmt(struct block_device *bdev, enum req_op op,
 	sector_t capacity = bdev_nr_sectors(bdev);
 	sector_t end_sector = sector + nr_sectors;
 	struct bio *bio = NULL;
-	int ret = 0;
+	int ret;
 
 	if (!bdev_is_zoned(bdev))
 		return -EOPNOTSUPP;
Signature · 1 line
2.18.2
#2 lore raw
In reply to Li zeming
Quoted 1 line

ret is assigned first, so it does not need to initialize the assignment.

* Would a wording approach (like the following) be a bit nicer?

The variable “ret” will eventually be set to an appropriate value a bit later. Thus omit the explicit initialisation at the beginning.

* How do you think about to use the summary phrase “Delete an unnecessary initialisation in blkdev_zone_mgmt()”?

Regards,
Markus