Skip to contentSkip to conversation

jbd: Simplify return path of journal_init_common()

PATCH In review Namhyung Kim 2 participants 2 messages Oct 4, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 jbd: Simplify return path of journal_init_common()

---
 fs/jbd/journal.c |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)
fs/jbd/journal.c +3 -4
index 2c4b1f1..6f20a75 100644
@@ -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:
Signature · 1 line
1.7.0.4
#1 lore raw
Quoted 19 lines · Namhyung Kim
---
 fs/jbd/journal.c |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)
fs/jbd/journal.c +1 -1
index 2c4b1f1..6f20a75 100644
@@ -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);

fs/jbd/journal.c static journal_t * journal_init_common (void) · line 728

Quoted 10 lines
fs/jbd/journal.c +2 -3
@@ -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

Signature · 2 lines
Jan Kara <[email protected]>
SUSE Labs, CR