Commit 7438370a authored by Yash Shah's avatar Yash Shah Committed by Greg Kroah-Hartman

Staging: rdma:Delete unnecessary NULL check before calling function "kmem_cache_destroy"

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: default avatarYash Shah <yshah1@visteon.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent a054374f
...@@ -275,6 +275,5 @@ int ehca_init_av_cache(void) ...@@ -275,6 +275,5 @@ int ehca_init_av_cache(void)
void ehca_cleanup_av_cache(void) void ehca_cleanup_av_cache(void)
{ {
if (av_cache) kmem_cache_destroy(av_cache);
kmem_cache_destroy(av_cache);
} }
...@@ -393,6 +393,5 @@ int ehca_init_cq_cache(void) ...@@ -393,6 +393,5 @@ int ehca_init_cq_cache(void)
void ehca_cleanup_cq_cache(void) void ehca_cleanup_cq_cache(void)
{ {
if (cq_cache) kmem_cache_destroy(cq_cache);
kmem_cache_destroy(cq_cache);
} }
...@@ -245,8 +245,7 @@ static void ehca_destroy_slab_caches(void) ...@@ -245,8 +245,7 @@ static void ehca_destroy_slab_caches(void)
ehca_cleanup_cq_cache(); ehca_cleanup_cq_cache();
ehca_cleanup_pd_cache(); ehca_cleanup_pd_cache();
#ifdef CONFIG_PPC_64K_PAGES #ifdef CONFIG_PPC_64K_PAGES
if (ctblk_cache) kmem_cache_destroy(ctblk_cache);
kmem_cache_destroy(ctblk_cache);
#endif #endif
} }
......
...@@ -2251,10 +2251,8 @@ int ehca_init_mrmw_cache(void) ...@@ -2251,10 +2251,8 @@ int ehca_init_mrmw_cache(void)
void ehca_cleanup_mrmw_cache(void) void ehca_cleanup_mrmw_cache(void)
{ {
if (mr_cache) kmem_cache_destroy(mr_cache);
kmem_cache_destroy(mr_cache); kmem_cache_destroy(mw_cache);
if (mw_cache)
kmem_cache_destroy(mw_cache);
} }
static inline int ehca_init_top_bmap(struct ehca_top_bmap *ehca_top_bmap, static inline int ehca_init_top_bmap(struct ehca_top_bmap *ehca_top_bmap,
......
...@@ -119,6 +119,5 @@ int ehca_init_pd_cache(void) ...@@ -119,6 +119,5 @@ int ehca_init_pd_cache(void)
void ehca_cleanup_pd_cache(void) void ehca_cleanup_pd_cache(void)
{ {
if (pd_cache) kmem_cache_destroy(pd_cache);
kmem_cache_destroy(pd_cache);
} }
...@@ -2252,6 +2252,5 @@ int ehca_init_qp_cache(void) ...@@ -2252,6 +2252,5 @@ int ehca_init_qp_cache(void)
void ehca_cleanup_qp_cache(void) void ehca_cleanup_qp_cache(void)
{ {
if (qp_cache) kmem_cache_destroy(qp_cache);
kmem_cache_destroy(qp_cache);
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment