From: Keith Busch Date: Thu, 6 Nov 2025 01:54:44 +0000 (-0800) Subject: null_blk: simplify copy_from_nullb X-Git-Tag: v6.19-rc1~168^2~76 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1165d20f4d1abba59ff2f032df271605ad49c255;p=thirdparty%2Fkernel%2Flinux.git null_blk: simplify copy_from_nullb It always returns success, so the code that saves the errors status, but proceeds without checking it looks a bit odd. Clean this up. Signed-off-by: Keith Busch Reviewed-by: Christoph Hellwig Reviewed-by: Johannes Thumshirn Reviewed-by: Damien Le Moal Reviewed-by: Chaitanya Kulkarni Tested-by: Hans Holmberg Signed-off-by: Jens Axboe --- diff --git a/drivers/block/null_blk/main.c b/drivers/block/null_blk/main.c index f982027e8c858..e2597ea696bff 100644 --- a/drivers/block/null_blk/main.c +++ b/drivers/block/null_blk/main.c @@ -1161,7 +1161,7 @@ static int copy_to_nullb(struct nullb *nullb, struct page *source, return 0; } -static int copy_from_nullb(struct nullb *nullb, struct page *dest, +static void copy_from_nullb(struct nullb *nullb, struct page *dest, unsigned int off, sector_t sector, size_t n) { size_t temp, count = 0; @@ -1184,7 +1184,6 @@ static int copy_from_nullb(struct nullb *nullb, struct page *dest, count += temp; sector += temp >> SECTOR_SHIFT; } - return 0; } static void nullb_fill_pattern(struct nullb *nullb, struct page *page, @@ -1248,8 +1247,8 @@ static int null_transfer(struct nullb *nullb, struct page *page, sector, len); if (valid_len) { - err = copy_from_nullb(nullb, page, off, - sector, valid_len); + copy_from_nullb(nullb, page, off, sector, + valid_len); off += valid_len; len -= valid_len; }