Skip to contentSkip to conversation

drivers/block/zram/zram_drv.c: remove ret check for invalid io request

PATCH New Yue Hu 1 participant 1 message May 30, 2020

Subsystems (2)
lore
Share & tools
lore

Yue Hu

author
#0 lore raw

PATCH 1/1 drivers/block/zram/zram_drv.c: remove ret check for invalid io request

From: Yue Hu <[email protected]>

There is no need to goto out to check ret if it's an invalid io request since we know ret = -EINVAL. Let's return the error directly in that case.

---
 drivers/block/zram/zram_drv.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/block/zram/zram_drv.c +2 -3
index 1bdb5793842b..bdca06930504 100644
@@ -1639,8 +1639,7 @@ static int zram_rw_page(struct block_device *bdev, sector_t sector,
 
 	if (!valid_io_request(zram, sector, PAGE_SIZE)) {
 		atomic64_inc(&zram->stats.invalid_io);
-		ret = -EINVAL;
-		goto out;
+		return -EINVAL;
 	}
 
 	index = sector >> SECTORS_PER_PAGE_SHIFT;
@@ -1651,7 +1650,7 @@ static int zram_rw_page(struct block_device *bdev, sector_t sector,
 	bv.bv_offset = 0;
 
 	ret = zram_bvec_rw(zram, &bv, index, offset, op, NULL);
-out:
+
 	/*
 	 * If I/O fails, just return error(ie, non-zero) without
 	 * calling page_endio.
Signature · 1 line
2.11.0