linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] jbd: Simplify return path of journal_init_common()
@ 2010-10-04  5:49 Namhyung Kim
  2010-10-04  9:47 ` Jan Kara
  0 siblings, 1 reply; 2+ messages in thread
From: Namhyung Kim @ 2010-10-04  5:49 UTC (permalink / raw)
  To: Andrew Morton, Jan Kara; +Cc: linux-ext4, linux-kernel

Signed-off-by: Namhyung Kim <namhyung@gmail.com>
---
 fs/jbd/journal.c |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/fs/jbd/journal.c b/fs/jbd/journal.c
index 2c4b1f1..6f20a75 100644
--- a/fs/jbd/journal.c
+++ b/fs/jbd/journal.c
@@ -698,7 +698,7 @@ static journal_t * journal_init_common (void)
 
 	journal = kzalloc(sizeof(*journal), GFP_KERNEL);
 	if (!journal)
-		goto fail;
+		goto out;
 
 	init_waitqueue_head(&journal->j_wait_transaction_locked);
 	init_waitqueue_head(&journal->j_wait_logspace);
@@ -721,11 +721,10 @@ static journal_t * journal_init_common (void)
 	err = journal_init_revoke(journal, JOURNAL_REVOKE_DEFAULT_HASH);
 	if (err) {
 		kfree(journal);
-		goto fail;
+		journal = NULL;
 	}
+out:
 	return journal;
-fail:
-	return NULL;
 }
 
 /* journal_init_dev and journal_init_inode:
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] jbd: Simplify return path of journal_init_common()
  2010-10-04  5:49 [PATCH] jbd: Simplify return path of journal_init_common() Namhyung Kim
@ 2010-10-04  9:47 ` Jan Kara
  0 siblings, 0 replies; 2+ messages in thread
From: Jan Kara @ 2010-10-04  9:47 UTC (permalink / raw)
  To: Namhyung Kim; +Cc: Andrew Morton, Jan Kara, linux-ext4, linux-kernel

On Mon 04-10-10 14:49:58, Namhyung Kim wrote:
> Signed-off-by: Namhyung Kim <namhyung@gmail.com>
> ---
>  fs/jbd/journal.c |    7 +++----
>  1 files changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/fs/jbd/journal.c b/fs/jbd/journal.c
> index 2c4b1f1..6f20a75 100644
> --- a/fs/jbd/journal.c
> +++ b/fs/jbd/journal.c
> @@ -698,7 +698,7 @@ static journal_t * journal_init_common (void)
>  
>  	journal = kzalloc(sizeof(*journal), GFP_KERNEL);
>  	if (!journal)
> -		goto fail;
> +		goto out;
>  
>  	init_waitqueue_head(&journal->j_wait_transaction_locked);
>  	init_waitqueue_head(&journal->j_wait_logspace);
> @@ -721,11 +721,10 @@ static journal_t * journal_init_common (void)
>  	err = journal_init_revoke(journal, JOURNAL_REVOKE_DEFAULT_HASH);
>  	if (err) {
>  		kfree(journal);
> -		goto fail;
> +		journal = NULL;
>  	}
> +out:
>  	return journal;
> -fail:
> -	return NULL;
  If you want to do something like this (but frankly I'm not so convinced
that the cleanup is worth the code churn), then just do directly
"return NULL". The function is simple enough... Thanks.

								Honza
-- 
Jan Kara <jack@suse.cz>
SUSE Labs, CR

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-10-04  9:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-04  5:49 [PATCH] jbd: Simplify return path of journal_init_common() Namhyung Kim
2010-10-04  9:47 ` Jan Kara

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).