Skip to contentSkip to conversation

btrfs: remove redundant ret variable in delete_v1_space_cache

PATCH In review [email protected] 2 participants 2 messages Nov 15, 2022 Btrfs file system

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 btrfs: remove redundant ret variable in delete_v1_space_cache

From: guo ziliang <[email protected]>
Return value from delete_block_group_cache() directly instead of taking this in another redundant variable.

---
 fs/btrfs/relocation.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
fs/btrfs/relocation.c +1 -3
index 56c8afa..d7f76cf 100644
@@ -3374,7 +3374,6 @@ static int delete_v1_space_cache(struct extent_buffer *leaf,
        struct btrfs_key key;
        bool found = false;
        int i;
-       int ret;
 
        if (btrfs_header_owner(leaf) != BTRFS_ROOT_TREE_OBJECTID)
                return 0;
@@ -3398,9 +3397,8 @@ static int delete_v1_space_cache(struct extent_buffer *leaf,
        }
        if (!found)
                return -ENOENT;
-       ret = delete_block_group_cache(leaf->fs_info, block_group, NULL,
+       return delete_block_group_cache(leaf->fs_info, block_group, NULL,
                                        space_cache_ino);
-       return ret;
 }
 
 /*

--
1.8.3.1

#1 lore raw
Quoted 3 lines · On Tue, Nov 15, 2022 at 09:14:56AM +0800, [email protected] wrote:

From: guo ziliang <[email protected]>
Return value from delete_block_group_cache() directly instead of taking this in another redundant variable.

Have you found this manually or by some tool? I did a quick grep and found 14 other cases that could be simplified like that. I'm not sure if we really need it, but if you fix more than one case then lets do it.