summaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorWen Yang <wen.yang99@zte.com.cn>2018-11-28 15:25:00 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-12-13 08:52:07 +0100
commit3b0107ca80fbd03991ad568ef14fe13199703592 (patch)
treee9858bfe199e92e711f390a663f787e1606d58c8 /fs
parent980cd9a18b16ba1ff07d60101c1d836d7df5e18f (diff)
downloadlinux-stable-3b0107ca80fbd03991ad568ef14fe13199703592.tar.gz
linux-stable-3b0107ca80fbd03991ad568ef14fe13199703592.tar.bz2
linux-stable-3b0107ca80fbd03991ad568ef14fe13199703592.zip
dlm: NULL check before kmem_cache_destroy is not needed
[ Upstream commit f31a89692830061bceba8469607e4e4b0f900159 ] kmem_cache_destroy(NULL) is safe, so removes NULL check before freeing the mem. This patch also fix ifnullfree.cocci warnings. Signed-off-by: Wen Yang <wen.yang99@zte.com.cn> Signed-off-by: David Teigland <teigland@redhat.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'fs')
-rw-r--r--fs/dlm/memory.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/fs/dlm/memory.c b/fs/dlm/memory.c
index 7cd24bccd4fe..37be29f21d04 100644
--- a/fs/dlm/memory.c
+++ b/fs/dlm/memory.c
@@ -38,10 +38,8 @@ int __init dlm_memory_init(void)
void dlm_memory_exit(void)
{
- if (lkb_cache)
- kmem_cache_destroy(lkb_cache);
- if (rsb_cache)
- kmem_cache_destroy(rsb_cache);
+ kmem_cache_destroy(lkb_cache);
+ kmem_cache_destroy(rsb_cache);
}
char *dlm_allocate_lvb(struct dlm_ls *ls)
@@ -86,8 +84,7 @@ void dlm_free_lkb(struct dlm_lkb *lkb)
struct dlm_user_args *ua;
ua = lkb->lkb_ua;
if (ua) {
- if (ua->lksb.sb_lvbptr)
- kfree(ua->lksb.sb_lvbptr);
+ kfree(ua->lksb.sb_lvbptr);
kfree(ua);
}
}