archive mirror
 help / color / mirror / Atom feed
From: Colin King <>
To: Minchan Kim <>, Nitin Gupta <>,
	Sergey Senozhatsky <>,
	Jens Axboe <>,
Subject: [PATCH] zram: fix error return codes not being returned in writeback_store
Date: Thu, 28 Nov 2019 12:29:58 +0000	[thread overview]
Message-ID: <> (raw)

From: Colin Ian King <>

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")
Fixes: a939888ec38b ("zram: support idle/huge page writeback")
Signed-off-by: Colin Ian King <>
 drivers/block/zram/zram_drv.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c
index 4285e75e52c3..1bf4a908a0bd 100644
--- a/drivers/block/zram/zram_drv.c
+++ b/drivers/block/zram/zram_drv.c
@@ -626,7 +626,7 @@ static ssize_t writeback_store(struct device *dev,
 	struct bio bio;
 	struct bio_vec bio_vec;
 	struct page *page;
-	ssize_t ret;
+	ssize_t ret = len;
 	int mode;
 	unsigned long blk_idx = 0;
@@ -762,7 +762,6 @@ static ssize_t writeback_store(struct device *dev,
 	if (blk_idx)
 		free_block_bdev(zram, blk_idx);
-	ret = len;

             reply	other threads:[~2019-11-28 12:30 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-28 12:29 Colin King [this message]
2019-12-04  1:16 ` Minchan Kim

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \ \ \ \ \ \ \
    --subject='Re: [PATCH] zram: fix error return codes not being returned in writeback_store' \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).