[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <55993450.9090102@users.sourceforge.net>
Date: Sun, 05 Jul 2015 15:42:40 +0200
From: SF Markus Elfring <elfring@...rs.sourceforge.net>
To: Joel Becker <jlbec@...lplan.org>, Mark Fasheh <mfasheh@...e.com>,
ocfs2-devel@....oracle.com
CC: LKML <linux-kernel@...r.kernel.org>,
kernel-janitors@...r.kernel.org,
Julia Lawall <julia.lawall@...6.fr>
Subject: [PATCH 11/11] ocfs2: One function call less in ocfs2_journal_shutdown()
from input checks
From: Markus Elfring <elfring@...rs.sourceforge.net>
Date: Sun, 5 Jul 2015 14:54:33 +0200
The iput() function was called in one case by the ocfs2_journal_shutdown()
function during input parameter validation even if the passed
variable contained still a null pointer.
* Return directly if received values indicate that at the beginning.
* Delete the unnecessary jump label "done".
* Drop unnecessary initialisations for the variables "inode",
"journal" and "num_running_trans" then.
Signed-off-by: Markus Elfring <elfring@...rs.sourceforge.net>
---
fs/ocfs2/journal.c | 15 ++++++---------
1 file changed, 6 insertions(+), 9 deletions(-)
diff --git a/fs/ocfs2/journal.c b/fs/ocfs2/journal.c
index 7bb50f4..f13e6fdb 100644
--- a/fs/ocfs2/journal.c
+++ b/fs/ocfs2/journal.c
@@ -951,22 +951,20 @@ static int ocfs2_journal_toggle_dirty(struct ocfs2_super *osb,
*/
void ocfs2_journal_shutdown(struct ocfs2_super *osb)
{
- struct ocfs2_journal *journal = NULL;
+ struct ocfs2_journal *journal;
int status = 0;
- struct inode *inode = NULL;
- int num_running_trans = 0;
+ struct inode *inode;
+ int num_running_trans;
BUG_ON(!osb);
journal = osb->journal;
if (!journal)
- goto done;
-
- inode = journal->j_inode;
-
+ return;
if (journal->j_state != OCFS2_JOURNAL_LOADED)
- goto done;
+ return;
+ inode = journal->j_inode;
/* need to inc inode use count - jbd2_journal_destroy will iput. */
if (!igrab(inode))
BUG();
@@ -1025,7 +1023,6 @@ void ocfs2_journal_shutdown(struct ocfs2_super *osb)
journal->j_state = OCFS2_JOURNAL_FREE;
// up_write(&journal->j_trans_barrier);
-done:
iput(inode);
}
--
2.4.5
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists