Skip to content

Commit 3b82a05

Browse files
Colin Ian Kingtorvalds
authored andcommitted
drivers/block/zram/zram_drv.c: fix error return codes not being returned in writeback_store
Currently when an error code -EIO or -ENOSPC in the for-loop of writeback_store the error code is being overwritten by a ret = len assignment at the end of the function and the error codes are being lost. Fix this by assigning ret = len at the start of the function and remove the assignment from the end, hence allowing ret to be preserved when error codes are assigned to it. Addresses Coverity ("Unused value") Link: http://lkml.kernel.org/r/[email protected] Fixes: a939888 ("zram: support idle/huge page writeback") Signed-off-by: Colin Ian King <[email protected]> Acked-by: Minchan Kim <[email protected]> Cc: Sergey Senozhatsky <[email protected]> Cc: Jens Axboe <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent 90f82cb commit 3b82a05

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

drivers/block/zram/zram_drv.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -629,7 +629,7 @@ static ssize_t writeback_store(struct device *dev,
629629
struct bio bio;
630630
struct bio_vec bio_vec;
631631
struct page *page;
632-
ssize_t ret;
632+
ssize_t ret = len;
633633
int mode;
634634
unsigned long blk_idx = 0;
635635

@@ -765,7 +765,6 @@ static ssize_t writeback_store(struct device *dev,
765765

766766
if (blk_idx)
767767
free_block_bdev(zram, blk_idx);
768-
ret = len;
769768
__free_page(page);
770769
release_init_lock:
771770
up_read(&zram->init_lock);

0 commit comments

Comments
 (0)