[PATCH 16/21] ext4: remove unnecessary exit_meta_group_info tag

Kemeng Shi posted 21 patches 2 years, 7 months ago
There is a newer version of this series
[PATCH 16/21] ext4: remove unnecessary exit_meta_group_info tag
Posted by Kemeng Shi 2 years, 7 months ago
We goto exit_meta_group_info only to return -ENOMEM. Return -ENOMEM
directly instead of goto to remove this unnecessary tag.

Signed-off-by: Kemeng Shi <shikemeng@huaweicloud.com>
---
 fs/ext4/mballoc.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
index c684758d6dbb..289dcd81dd5a 100644
--- a/fs/ext4/mballoc.c
+++ b/fs/ext4/mballoc.c
@@ -3069,7 +3069,7 @@ int ext4_mb_add_groupinfo(struct super_block *sb, ext4_group_t group,
 		if (meta_group_info == NULL) {
 			ext4_msg(sb, KERN_ERR, "can't allocate mem "
 				 "for a buddy group");
-			goto exit_meta_group_info;
+			return -ENOMEM;
 		}
 		rcu_read_lock();
 		rcu_dereference(sbi->s_group_info)[idx] = meta_group_info;
@@ -3123,7 +3123,6 @@ int ext4_mb_add_groupinfo(struct super_block *sb, ext4_group_t group,
 		group_info[idx] = NULL;
 		rcu_read_unlock();
 	}
-exit_meta_group_info:
 	return -ENOMEM;
 } /* ext4_mb_add_groupinfo */
 
-- 
2.30.0
Re: [PATCH 16/21] ext4: remove unnecessary exit_meta_group_info tag
Posted by Ojaswin Mujoo 2 years, 7 months ago
On Fri, Feb 10, 2023 at 03:48:20AM +0800, Kemeng Shi wrote:
> We goto exit_meta_group_info only to return -ENOMEM. Return -ENOMEM
> directly instead of goto to remove this unnecessary tag.
> 
> Signed-off-by: Kemeng Shi <shikemeng@huaweicloud.com>
> ---
>  fs/ext4/mballoc.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
> index c684758d6dbb..289dcd81dd5a 100644
> --- a/fs/ext4/mballoc.c
> +++ b/fs/ext4/mballoc.c
> @@ -3069,7 +3069,7 @@ int ext4_mb_add_groupinfo(struct super_block *sb, ext4_group_t group,
>  		if (meta_group_info == NULL) {
>  			ext4_msg(sb, KERN_ERR, "can't allocate mem "
>  				 "for a buddy group");
> -			goto exit_meta_group_info;
> +			return -ENOMEM;
>  		}
>  		rcu_read_lock();
>  		rcu_dereference(sbi->s_group_info)[idx] = meta_group_info;
> @@ -3123,7 +3123,6 @@ int ext4_mb_add_groupinfo(struct super_block *sb, ext4_group_t group,
>  		group_info[idx] = NULL;
>  		rcu_read_unlock();
>  	}
> -exit_meta_group_info:
>  	return -ENOMEM;
>  } /* ext4_mb_add_groupinfo */
>  
> -- 
> 2.30.0
> 
Looks good. Feel free to add:

Reviewed-by: Ojaswin Mujoo <ojaswin@linux.ibm.com>