From: Colin King <colin.king@canonical.com>
To: Chris Mason <clm@fb.com>, Josef Bacik <jbacik@fb.com>,
David Sterba <dsterba@suse.com>,
linux-btrfs@vger.kernel.org
Cc: kernel-janitors@vger.kernel.org
Subject: [PATCH] btrfs: remove redundant assignment and check on variable ret
Date: Sat, 6 May 2017 23:01:05 +0100 [thread overview]
Message-ID: <20170506220105.13206-1-colin.king@canonical.com> (raw)
From: Colin Ian King <colin.king@canonical.com>
Variable ret is assigned to zero and is always zero throughout the
function. Thus the check for ret being less than zero is always
false and so mapping_set_error always has an -EIO error passed to
it. Hence we can remove the redundant assignment and check on ret.
Detected by CoverityScan, CID#1414312 ("Logically dead code")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
fs/btrfs/extent_io.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
index d8da3edf2ac3..7922cd34ba82 100644
--- a/fs/btrfs/extent_io.c
+++ b/fs/btrfs/extent_io.c
@@ -2447,7 +2447,6 @@ void end_extent_writepage(struct page *page, int err, u64 start, u64 end)
{
int uptodate = (err == 0);
struct extent_io_tree *tree;
- int ret = 0;
tree = &BTRFS_I(page->mapping->host)->io_tree;
@@ -2458,8 +2457,7 @@ void end_extent_writepage(struct page *page, int err, u64 start, u64 end)
if (!uptodate) {
ClearPageUptodate(page);
SetPageError(page);
- ret = ret < 0 ? ret : -EIO;
- mapping_set_error(page->mapping, ret);
+ mapping_set_error(page->mapping, -EIO);
}
}
--
2.11.0
next reply other threads:[~2017-05-06 22:01 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-06 22:01 Colin King [this message]
2017-05-09 15:28 ` [PATCH] btrfs: remove redundant assignment and check on variable ret David Sterba
2017-05-09 16:55 ` Liu Bo
2017-05-09 17:01 ` Colin Ian King
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:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170506220105.13206-1-colin.king@canonical.com \
--to=colin.king@canonical.com \
--cc=clm@fb.com \
--cc=dsterba@suse.com \
--cc=jbacik@fb.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-btrfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).