mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] fs crypto: fix ifnullfree.cocci warnings
@ 2016-02-17 13:32 Julia Lawall
  0 siblings, 0 replies; only message in thread
From: Julia Lawall @ 2016-02-17 13:32 UTC (permalink / raw)
  To: Jaegeuk Kim
  Cc: kbuild-all, Theodore Ts'o, Michael Halcrow, Ildar Muslukhov,
	linux-kernel

 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);

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2016-02-17 13:33 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-17 13:32 [PATCH] fs crypto: fix ifnullfree.cocci warnings Julia Lawall

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®