drivers/block/zram/zram_drv.c: fix error return codes not being returned in writeback...
authorColin Ian King <colin.king@canonical.com>
Fri, 31 Jan 2020 06:15:25 +0000 (22:15 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 24 Feb 2020 07:36:31 +0000 (08:36 +0100)
commitb0d5c881d36ee822bdc57f70ec70f1ba232ee7e8
tree3698adc0b67928a61f2263c1157992d674a6f580
parent53aaa9f1a638e422871c71329f6e2c82b54cc0da
drivers/block/zram/zram_drv.c: fix error return codes not being returned in writeback_store

[ Upstream commit 3b82a051c10143639a378dcd12019f2353cc9054 ]

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/20191128122958.178290-1-colin.king@canonical.com
Fixes: a939888ec38b ("zram: support idle/huge page writeback")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Acked-by: Minchan Kim <minchan@kernel.org>
Cc: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Cc: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/block/zram/zram_drv.c