Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a17b485a authored by piaojun's avatar piaojun Committed by Linus Torvalds
Browse files

ocfs2: remove unnecessary null pointer check before kmem_cache_destroy()

As kmem_cache_destroy() already handles null pointers, so we can remove
the conditional test entirely.

Link: http://lkml.kernel.org/r/5A9EB21D.3000209@huawei.com


Signed-off-by: default avatarJun Piao <piaojun@huawei.com>
Reviewed-by: default avatarYiwen Jiang <jiangyiwen@huawei.com>
Reviewed-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Cc: Mark Fasheh <mark@fasheh.com>
Cc: Joel Becker <jlbec@evilplan.org>
Cc: Junxiao Bi <junxiao.bi@oracle.com>
Cc: Joseph Qi <jiangqi903@gmail.com>
Cc: Changwei Ge <ge.changwei@h3c.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent bb34f24c
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -77,7 +77,6 @@ int dlm_init_lock_cache(void)

void dlm_destroy_lock_cache(void)
{
	if (dlm_lock_cache)
	kmem_cache_destroy(dlm_lock_cache);
}

+5 −10
Original line number Diff line number Diff line
@@ -414,7 +414,6 @@ int dlm_init_mle_cache(void)

void dlm_destroy_mle_cache(void)
{
	if (dlm_mle_cache)
	kmem_cache_destroy(dlm_mle_cache);
}

@@ -472,16 +471,12 @@ int dlm_init_master_caches(void)

void dlm_destroy_master_caches(void)
{
	if (dlm_lockname_cache) {
	kmem_cache_destroy(dlm_lockname_cache);
	dlm_lockname_cache = NULL;
	}

	if (dlm_lockres_cache) {
	kmem_cache_destroy(dlm_lockres_cache);
	dlm_lockres_cache = NULL;
}
}

static void dlm_lockres_release(struct kref *kref)
{
+6 −12
Original line number Diff line number Diff line
@@ -1768,11 +1768,8 @@ static int ocfs2_initialize_mem_caches(void)
					NULL);
	if (!ocfs2_inode_cachep || !ocfs2_dquot_cachep ||
	    !ocfs2_qf_chunk_cachep) {
		if (ocfs2_inode_cachep)
		kmem_cache_destroy(ocfs2_inode_cachep);
		if (ocfs2_dquot_cachep)
		kmem_cache_destroy(ocfs2_dquot_cachep);
		if (ocfs2_qf_chunk_cachep)
		kmem_cache_destroy(ocfs2_qf_chunk_cachep);
		return -ENOMEM;
	}
@@ -1787,15 +1784,12 @@ static void ocfs2_free_mem_caches(void)
	 * destroy cache.
	 */
	rcu_barrier();
	if (ocfs2_inode_cachep)
	kmem_cache_destroy(ocfs2_inode_cachep);
	ocfs2_inode_cachep = NULL;

	if (ocfs2_dquot_cachep)
	kmem_cache_destroy(ocfs2_dquot_cachep);
	ocfs2_dquot_cachep = NULL;

	if (ocfs2_qf_chunk_cachep)
	kmem_cache_destroy(ocfs2_qf_chunk_cachep);
	ocfs2_qf_chunk_cachep = NULL;
}
+1 −2
Original line number Diff line number Diff line
@@ -633,6 +633,5 @@ int __init init_ocfs2_uptodate_cache(void)

void exit_ocfs2_uptodate_cache(void)
{
	if (ocfs2_uptodate_cachep)
	kmem_cache_destroy(ocfs2_uptodate_cachep);
}