Commit f31a8969 authored by Wen Yang's avatar Wen Yang Committed by David Teigland

dlm: NULL check before kmem_cache_destroy is not needed

kmem_cache_destroy(NULL) is safe, so removes NULL check before
freeing the mem. This patch also fix ifnullfree.cocci warnings.
Signed-off-by: default avatarWen Yang <wen.yang99@zte.com.cn>
Signed-off-by: default avatarDavid Teigland <teigland@redhat.com>
parent 8fc6ed9a
...@@ -38,10 +38,8 @@ int __init dlm_memory_init(void) ...@@ -38,10 +38,8 @@ int __init dlm_memory_init(void)
void dlm_memory_exit(void) void dlm_memory_exit(void)
{ {
if (lkb_cache) kmem_cache_destroy(lkb_cache);
kmem_cache_destroy(lkb_cache); kmem_cache_destroy(rsb_cache);
if (rsb_cache)
kmem_cache_destroy(rsb_cache);
} }
char *dlm_allocate_lvb(struct dlm_ls *ls) char *dlm_allocate_lvb(struct dlm_ls *ls)
...@@ -86,8 +84,7 @@ void dlm_free_lkb(struct dlm_lkb *lkb) ...@@ -86,8 +84,7 @@ void dlm_free_lkb(struct dlm_lkb *lkb)
struct dlm_user_args *ua; struct dlm_user_args *ua;
ua = lkb->lkb_ua; ua = lkb->lkb_ua;
if (ua) { if (ua) {
if (ua->lksb.sb_lvbptr) kfree(ua->lksb.sb_lvbptr);
kfree(ua->lksb.sb_lvbptr);
kfree(ua); kfree(ua);
} }
} }
......
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