2021-02-04 23:21:00

by Yang Li

[permalink] [raw]
Subject: [PATCH] btrfs: Remove unneeded return variable

This patch removes unneeded return variables, using only
'0' instead.
It fixes the following warning detected by coccinelle:
./fs/btrfs/extent_map.c:299:5-8: Unneeded variable: "ret". Return "0" on
line 331
./fs/btrfs/disk-io.c:4402:5-8: Unneeded variable: "ret". Return "0" on
line 4410

Reported-by: Abaci Robot <[email protected]>
Signed-off-by: Yang Li <[email protected]>
---
fs/btrfs/disk-io.c | 5 ++---
fs/btrfs/extent_map.c | 3 +--
2 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index 6b35b7e..e951da7 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -4399,7 +4399,6 @@ static int btrfs_destroy_delayed_refs(struct btrfs_transaction *trans,
struct rb_node *node;
struct btrfs_delayed_ref_root *delayed_refs;
struct btrfs_delayed_ref_node *ref;
- int ret = 0;

delayed_refs = &trans->delayed_refs;

@@ -4407,7 +4406,7 @@ static int btrfs_destroy_delayed_refs(struct btrfs_transaction *trans,
if (atomic_read(&delayed_refs->num_entries) == 0) {
spin_unlock(&delayed_refs->lock);
btrfs_debug(fs_info, "delayed_refs has NO entry");
- return ret;
+ return 0;
}

while ((node = rb_first_cached(&delayed_refs->href_root)) != NULL) {
@@ -4473,7 +4472,7 @@ static int btrfs_destroy_delayed_refs(struct btrfs_transaction *trans,

spin_unlock(&delayed_refs->lock);

- return ret;
+ return 0;
}

static void btrfs_destroy_delalloc_inodes(struct btrfs_root *root)
diff --git a/fs/btrfs/extent_map.c b/fs/btrfs/extent_map.c
index bd6229f..bac7eba 100644
--- a/fs/btrfs/extent_map.c
+++ b/fs/btrfs/extent_map.c
@@ -296,7 +296,6 @@ static void try_merge_map(struct extent_map_tree *tree, struct extent_map *em)
int unpin_extent_cache(struct extent_map_tree *tree, u64 start, u64 len,
u64 gen)
{
- int ret = 0;
struct extent_map *em;
bool prealloc = false;

@@ -328,7 +327,7 @@ int unpin_extent_cache(struct extent_map_tree *tree, u64 start, u64 len,
free_extent_map(em);
out:
write_unlock(&tree->lock);
- return ret;
+ return 0;

}

--
1.8.3.1