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


Groups > linux.kernel > #1336428 > unrolled thread

[PATCH] fs crypto: fix ifnullfree.cocci warnings

Started byJulia Lawall <julia.lawall@lip6.fr>
First post2016-02-17 14:40 +0100
Last post2016-02-17 14:40 +0100
Articles 1 — 1 participant

Back to article view | Back to linux.kernel


Contents

  [PATCH] fs crypto: fix ifnullfree.cocci warnings Julia Lawall <julia.lawall@lip6.fr> - 2016-02-17 14:40 +0100

#1336428 — [PATCH] fs crypto: fix ifnullfree.cocci warnings

FromJulia Lawall <julia.lawall@lip6.fr>
Date2016-02-17 14:40 +0100
Subject[PATCH] fs crypto: fix ifnullfree.cocci warnings
Message-ID<r3auM-73z-51@gated-at.bofh.it>
 NULL check before some freeing functions is not needed.

Generated by: scripts/coccinelle/free/ifnullfree.cocci

Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Julia Lawall <julia.lawall@lip6.fr>

---

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

--- a/fs/crypto/crypto.c
+++ b/fs/crypto/crypto.c
@@ -414,8 +414,7 @@ static void fscrypt_destroy(void)
 	list_for_each_entry_safe(pos, n, &fscrypt_free_ctxs, free_list)
 		kmem_cache_free(fscrypt_ctx_cachep, pos);
 	INIT_LIST_HEAD(&fscrypt_free_ctxs);
-	if (fscrypt_bounce_page_pool)
-		mempool_destroy(fscrypt_bounce_page_pool);
+	mempool_destroy(fscrypt_bounce_page_pool);
 	fscrypt_bounce_page_pool = NULL;
 }

@@ -500,9 +499,7 @@ void __exit fscrypt_exit(void)

 	if (fscrypt_read_workqueue)
 		destroy_workqueue(fscrypt_read_workqueue);
-	if (fscrypt_ctx_cachep)
-		kmem_cache_destroy(fscrypt_ctx_cachep);
-	if (fscrypt_info_cachep)
-		kmem_cache_destroy(fscrypt_info_cachep);
+	kmem_cache_destroy(fscrypt_ctx_cachep);
+	kmem_cache_destroy(fscrypt_info_cachep);
 }
 module_exit(fscrypt_exit);

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web