]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commitdiff
Staging: rdma:Delete unnecessary NULL check before calling function "kmem_cache_destroy"
authorYash Shah <yshah1@visteon.com>
Tue, 8 Dec 2015 10:24:17 +0000 (10:24 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 21 Dec 2015 22:00:17 +0000 (14:00 -0800)
The kmem_cache_destroy() function tests whether its argument is NULL
and then returns immediately.
Thus the NULL check before calling this function is not needed.

This issue was detected by using the Coccinelle software.

Signed-off-by: Yash Shah <yshah1@visteon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/rdma/ehca/ehca_av.c
drivers/staging/rdma/ehca/ehca_cq.c
drivers/staging/rdma/ehca/ehca_main.c
drivers/staging/rdma/ehca/ehca_mrmw.c
drivers/staging/rdma/ehca/ehca_pd.c
drivers/staging/rdma/ehca/ehca_qp.c

index fd7b6d044ec1086aebd507d02f406fa646f75c00..94e088c2d989ac5ad3eb8177551bf3409d4edb14 100644 (file)
@@ -275,6 +275,5 @@ int ehca_init_av_cache(void)
 
 void ehca_cleanup_av_cache(void)
 {
-       if (av_cache)
-               kmem_cache_destroy(av_cache);
+       kmem_cache_destroy(av_cache);
 }
index ea1b5c1203b4e8292ea6aab4e9760b56c7cbe0b0..1aa7931fe860fe728787199ded51a9f5edae41ab 100644 (file)
@@ -393,6 +393,5 @@ int ehca_init_cq_cache(void)
 
 void ehca_cleanup_cq_cache(void)
 {
-       if (cq_cache)
-               kmem_cache_destroy(cq_cache);
+       kmem_cache_destroy(cq_cache);
 }
index 8246418cd4e085352f31954dc876c303a0b10daa..860b974e9faab6107aaecf748433fb415684024f 100644 (file)
@@ -245,8 +245,7 @@ static void ehca_destroy_slab_caches(void)
        ehca_cleanup_cq_cache();
        ehca_cleanup_pd_cache();
 #ifdef CONFIG_PPC_64K_PAGES
-       if (ctblk_cache)
-               kmem_cache_destroy(ctblk_cache);
+       kmem_cache_destroy(ctblk_cache);
 #endif
 }
 
index f914b30999f8d1519ee28edeb134762cf4796b52..553e883a5718ee0102f4923c5283e7d5ddded6a6 100644 (file)
@@ -2251,10 +2251,8 @@ int ehca_init_mrmw_cache(void)
 
 void ehca_cleanup_mrmw_cache(void)
 {
-       if (mr_cache)
-               kmem_cache_destroy(mr_cache);
-       if (mw_cache)
-               kmem_cache_destroy(mw_cache);
+       kmem_cache_destroy(mr_cache);
+       kmem_cache_destroy(mw_cache);
 }
 
 static inline int ehca_init_top_bmap(struct ehca_top_bmap *ehca_top_bmap,
index 351577a6670a5be1c24cf61416793f763aac3510..2a8aae411941f4bd73a23c5362f4bebd650008b1 100644 (file)
@@ -119,6 +119,5 @@ int ehca_init_pd_cache(void)
 
 void ehca_cleanup_pd_cache(void)
 {
-       if (pd_cache)
-               kmem_cache_destroy(pd_cache);
+       kmem_cache_destroy(pd_cache);
 }
index 2e89356c46faf7d53e5e37768d43ea4e812615ab..896c01f810f6fcc5e88ed38946a65982acd1d12f 100644 (file)
@@ -2252,6 +2252,5 @@ int ehca_init_qp_cache(void)
 
 void ehca_cleanup_qp_cache(void)
 {
-       if (qp_cache)
-               kmem_cache_destroy(qp_cache);
+       kmem_cache_destroy(qp_cache);
 }