Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1711938 > unrolled thread
| Started by | Colin King <colin.king@canonical.com> |
|---|---|
| First post | 2017-08-15 10:00 +0200 |
| Last post | 2017-08-17 14:00 +0200 |
| Articles | 2 — 2 participants |
Back to article view | Back to linux.kernel
[PATCH] btrfs: remove redundant check on ret being non-zero Colin King <colin.king@canonical.com> - 2017-08-15 10:00 +0200
Re: [PATCH] btrfs: remove redundant check on ret being non-zero David Sterba <dsterba@suse.cz> - 2017-08-17 14:00 +0200
| From | Colin King <colin.king@canonical.com> |
|---|---|
| Date | 2017-08-15 10:00 +0200 |
| Subject | [PATCH] btrfs: remove redundant check on ret being non-zero |
| Message-ID | <ueEVA-6Vl-19@gated-at.bofh.it> |
From: Colin Ian King <colin.king@canonical.com>
The error return variable ret is initialized to zero and then is
checked to see if it is non-zero in the if-block that follows it.
It is therefore impossible for ret to be non-zero after the if-block
hence the check is redundant and can be removed.
Detected by CoverityScan, CID#1021040 ("Logically dead code")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
fs/btrfs/tree-log.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
index 3a11ae63676e..f05fcc67efa6 100644
--- a/fs/btrfs/tree-log.c
+++ b/fs/btrfs/tree-log.c
@@ -1143,8 +1143,6 @@ static inline int __add_inode_ref(struct btrfs_trans_handle *trans,
goto again;
}
kfree(victim_name);
- if (ret)
- return ret;
next:
cur_offset += victim_name_len + sizeof(*extref);
}
--
2.11.0
[toc] | [next] | [standalone]
| From | David Sterba <dsterba@suse.cz> |
|---|---|
| Date | 2017-08-17 14:00 +0200 |
| Message-ID | <ufrCV-4m1-15@gated-at.bofh.it> |
| In reply to | #1711938 |
On Tue, Aug 15, 2017 at 08:51:02AM +0100, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> The error return variable ret is initialized to zero and then is
> checked to see if it is non-zero in the if-block that follows it.
> It is therefore impossible for ret to be non-zero after the if-block
> hence the check is redundant and can be removed.
>
> Detected by CoverityScan, CID#1021040 ("Logically dead code")
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
Reviewed-by: David Sterba <dsterba@suse.com>
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web