public inbox for linux-ext4@vger.kernel.org
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <djwong@kernel.org>
To: Haibo Liu <haiboliu6@gmail.com>
Cc: linux-ext4@vger.kernel.org
Subject: Re: ext4/super.c : Fix a goto label
Date: Mon, 28 Aug 2023 09:18:26 -0700	[thread overview]
Message-ID: <20230828161826.GA28156@frogsfrogsfrogs> (raw)
In-Reply-To: <20230828092726.19400-1-haiboliu6@gmail.com>

On Mon, Aug 28, 2023 at 05:27:26PM +0800, Haibo Liu wrote:
> There are 9 goto labels in ext4_init_fs: out,out05,out1,out2,out3,out4,out5,out6,out7. So I feel that replacing out5 with out0 may be better. 

...then why not replace them all with descriptions of what gets released
under each label?

	ret = init_inodecache();
	if (ret)
		goto out_unregister_mballoc;
	ret = init_somethingelse();
	if (ret)
		goto out_inodecache;

out_unregister_ext23:
	unregister_as_ext2();
	unregister_as_ext3();
out_inodecache:
	destroy_inodecache();
out_mballoc:
	ext4_exit_mballoc();

Is much more easier to understand than out[0...N], yes?

--D

> Signed-off-by: Haibo Liu <haiboliu6@gmail.com>
> ---
>  fs/ext4/super.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/ext4/super.c b/fs/ext4/super.c
> index 03373471131c..115bbbd95a7b 100644
> --- a/fs/ext4/super.c
> +++ b/fs/ext4/super.c
> @@ -6696,7 +6696,7 @@ static int __init ext4_init_fs(void)
>  
>  	err = ext4_fc_init_dentry_cache();
>  	if (err)
> -		goto out05;
> +		goto out0;
>  
>  	register_as_ext3();
>  	register_as_ext2();
> @@ -6708,7 +6708,7 @@ static int __init ext4_init_fs(void)
>  out:
>  	unregister_as_ext2();
>  	unregister_as_ext3();
> -out05:
> +out0:
>  	destroy_inodecache();
>  out1:
>  	ext4_exit_mballoc();
> -- 
> 2.34.1
> 

  reply	other threads:[~2023-08-28 16:19 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-28  9:27 ext4/super.c : Fix a goto label Haibo Liu
2023-08-28 16:18 ` Darrick J. Wong [this message]
2023-08-29  7:52 ` [v2] " Haibo Liu
2024-01-02 14:22   ` Jan Kara

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=20230828161826.GA28156@frogsfrogsfrogs \
    --to=djwong@kernel.org \
    --cc=haiboliu6@gmail.com \
    --cc=linux-ext4@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