Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1223639

[PATCH 37/39] f2fs crypto: drop null test before destroy functions

From Julia Lawall <Julia.Lawall@lip6.fr>
Newsgroups linux.kernel
Subject [PATCH 37/39] f2fs crypto: drop null test before destroy functions
Date 2015-09-13 14:30 +0200
Message-ID <q8ezV-7xJ-33@gated-at.bofh.it> (permalink)
References <q8ezT-7xJ-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Remove unneeded NULL test.

The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@@ expression x; @@
-if (x != NULL)
  \(kmem_cache_destroy\|mempool_destroy\|dma_pool_destroy\)(x);
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

---
 fs/f2fs/crypto.c |    9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/fs/f2fs/crypto.c b/fs/f2fs/crypto.c
index 4a62ef1..3c27f04 100644
--- a/fs/f2fs/crypto.c
+++ b/fs/f2fs/crypto.c
@@ -183,8 +183,7 @@ static void f2fs_crypto_destroy(void)
 	list_for_each_entry_safe(pos, n, &f2fs_free_crypto_ctxs, free_list)
 		kmem_cache_free(f2fs_crypto_ctx_cachep, pos);
 	INIT_LIST_HEAD(&f2fs_free_crypto_ctxs);
-	if (f2fs_bounce_page_pool)
-		mempool_destroy(f2fs_bounce_page_pool);
+	mempool_destroy(f2fs_bounce_page_pool);
 	f2fs_bounce_page_pool = NULL;
 }
 
@@ -240,10 +239,8 @@ void f2fs_exit_crypto(void)
 
 	if (f2fs_read_workqueue)
 		destroy_workqueue(f2fs_read_workqueue);
-	if (f2fs_crypto_ctx_cachep)
-		kmem_cache_destroy(f2fs_crypto_ctx_cachep);
-	if (f2fs_crypt_info_cachep)
-		kmem_cache_destroy(f2fs_crypt_info_cachep);
+	kmem_cache_destroy(f2fs_crypto_ctx_cachep);
+	kmem_cache_destroy(f2fs_crypt_info_cachep);
 }
 
 int __init f2fs_init_crypto(void)

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[PATCH 37/39] f2fs crypto: drop null test before destroy functions Julia Lawall <Julia.Lawall@lip6.fr> - 2015-09-13 14:30 +0200
  RE: [PATCH 37/39] f2fs crypto: drop null test before destroy functions Chao Yu <chao2.yu@samsung.com> - 2015-09-16 12:20 +0200

csiph-web