]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
null_blk: simplify copy_from_nullb
authorKeith Busch <kbusch@kernel.org>
Thu, 6 Nov 2025 01:54:44 +0000 (17:54 -0800)
committerJens Axboe <axboe@kernel.dk>
Thu, 6 Nov 2025 23:27:21 +0000 (16:27 -0700)
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 <kbusch@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>
Tested-by: Hans Holmberg <hans.holmberg@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
drivers/block/null_blk/main.c

index f982027e8c85827eb3ef3834153e8ca147415800..e2597ea696bff59ff305d984dfbfa659e87499cb 100644 (file)
@@ -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;
                }