From 8bdd5b60e0273e6682d5c269c70e6287ae60eb55 Mon Sep 17 00:00:00 2001 From: Wang Long Date: Sun, 20 May 2018 22:38:26 -0400 Subject: jbd2: remove NULL check before calling kmem_cache_destroy() The kmem_cache_destroy() function already checks for null pointers, so we can remove the check at the call site. This patch also sets jbd2_handle_cache and jbd2_inode_cache to be NULL after freeing them in jbd2_journal_destroy_handle_cache(). Signed-off-by: Wang Long Signed-off-by: Theodore Ts'o Reviewed-by: Jan Kara --- fs/jbd2/transaction.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'fs/jbd2/transaction.c') diff --git a/fs/jbd2/transaction.c b/fs/jbd2/transaction.c index 8aa453784402..51dd68e67b0f 100644 --- a/fs/jbd2/transaction.c +++ b/fs/jbd2/transaction.c @@ -49,10 +49,8 @@ int __init jbd2_journal_init_transaction_cache(void) void jbd2_journal_destroy_transaction_cache(void) { - if (transaction_cache) { - kmem_cache_destroy(transaction_cache); - transaction_cache = NULL; - } + kmem_cache_destroy(transaction_cache); + transaction_cache = NULL; } void jbd2_journal_free_transaction(transaction_t *transaction) -- cgit v1.2.3