The patch titled Subject: ocfs2: remove unnecessary null pointer check before kmem_cache_destroy() has been added to the -mm tree. Its filename is ocfs2-remove-unnecessary-null-pointer-check-before-kmem_cache_destroy.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/ocfs2-remove-unnecessary-null-pointer-check-before-kmem_cache_destroy.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/ocfs2-remove-unnecessary-null-pointer-check-before-kmem_cache_destroy.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: piaojun <piaojun@xxxxxxxxxx> Subject: 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@xxxxxxxxxx Signed-off-by: Jun Piao <piaojun@xxxxxxxxxx> Reviewed-by: Yiwen Jiang <jiangyiwen@xxxxxxxxxx> Reviewed-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> Cc: Mark Fasheh <mfasheh@xxxxxxxxxxx> Cc: Joel Becker <jlbec@xxxxxxxxxxxx> Cc: Junxiao Bi <junxiao.bi@xxxxxxxxxx> Cc: Joseph Qi <jiangqi903@xxxxxxxxx> Cc: Changwei Ge <ge.changwei@xxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- fs/ocfs2/dlm/dlmlock.c | 3 +-- fs/ocfs2/dlm/dlmmaster.c | 17 ++++++----------- fs/ocfs2/super.c | 18 ++++++------------ fs/ocfs2/uptodate.c | 3 +-- 4 files changed, 14 insertions(+), 27 deletions(-) diff -puN fs/ocfs2/dlm/dlmlock.c~ocfs2-remove-unnecessary-null-pointer-check-before-kmem_cache_destroy fs/ocfs2/dlm/dlmlock.c --- a/fs/ocfs2/dlm/dlmlock.c~ocfs2-remove-unnecessary-null-pointer-check-before-kmem_cache_destroy +++ a/fs/ocfs2/dlm/dlmlock.c @@ -77,8 +77,7 @@ int dlm_init_lock_cache(void) void dlm_destroy_lock_cache(void) { - if (dlm_lock_cache) - kmem_cache_destroy(dlm_lock_cache); + kmem_cache_destroy(dlm_lock_cache); } /* Tell us whether we can grant a new lock request. diff -puN fs/ocfs2/dlm/dlmmaster.c~ocfs2-remove-unnecessary-null-pointer-check-before-kmem_cache_destroy fs/ocfs2/dlm/dlmmaster.c --- a/fs/ocfs2/dlm/dlmmaster.c~ocfs2-remove-unnecessary-null-pointer-check-before-kmem_cache_destroy +++ a/fs/ocfs2/dlm/dlmmaster.c @@ -414,8 +414,7 @@ int dlm_init_mle_cache(void) void dlm_destroy_mle_cache(void) { - if (dlm_mle_cache) - kmem_cache_destroy(dlm_mle_cache); + kmem_cache_destroy(dlm_mle_cache); } static void dlm_mle_release(struct kref *kref) @@ -472,15 +471,11 @@ bail: 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; - } + kmem_cache_destroy(dlm_lockname_cache); + dlm_lockname_cache = NULL; + + kmem_cache_destroy(dlm_lockres_cache); + dlm_lockres_cache = NULL; } static void dlm_lockres_release(struct kref *kref) diff -puN fs/ocfs2/super.c~ocfs2-remove-unnecessary-null-pointer-check-before-kmem_cache_destroy fs/ocfs2/super.c --- a/fs/ocfs2/super.c~ocfs2-remove-unnecessary-null-pointer-check-before-kmem_cache_destroy +++ a/fs/ocfs2/super.c @@ -1768,12 +1768,9 @@ static int ocfs2_initialize_mem_caches(v 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); + kmem_cache_destroy(ocfs2_inode_cachep); + kmem_cache_destroy(ocfs2_dquot_cachep); + kmem_cache_destroy(ocfs2_qf_chunk_cachep); return -ENOMEM; } @@ -1787,16 +1784,13 @@ static void ocfs2_free_mem_caches(void) * destroy cache. */ rcu_barrier(); - if (ocfs2_inode_cachep) - kmem_cache_destroy(ocfs2_inode_cachep); + kmem_cache_destroy(ocfs2_inode_cachep); ocfs2_inode_cachep = NULL; - if (ocfs2_dquot_cachep) - kmem_cache_destroy(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); + kmem_cache_destroy(ocfs2_qf_chunk_cachep); ocfs2_qf_chunk_cachep = NULL; } diff -puN fs/ocfs2/uptodate.c~ocfs2-remove-unnecessary-null-pointer-check-before-kmem_cache_destroy fs/ocfs2/uptodate.c --- a/fs/ocfs2/uptodate.c~ocfs2-remove-unnecessary-null-pointer-check-before-kmem_cache_destroy +++ a/fs/ocfs2/uptodate.c @@ -633,6 +633,5 @@ int __init init_ocfs2_uptodate_cache(voi void exit_ocfs2_uptodate_cache(void) { - if (ocfs2_uptodate_cachep) - kmem_cache_destroy(ocfs2_uptodate_cachep); + kmem_cache_destroy(ocfs2_uptodate_cachep); } _ Patches currently in -mm which might be from piaojun@xxxxxxxxxx are ocfs2-use-osb-instead-of-ocfs2_sb.patch ocfs2-use-oi-instead-of-ocfs2_i.patch ocfs2-clean-up-some-unused-function-declaration.patch ocfs2-dlm-dont-handle-migrate-lockres-if-already-in-shutdown.patch ocfs2-dlm-dont-handle-migrate-lockres-if-already-in-shutdown-v3.patch ocfs2-remove-unnecessary-null-pointer-check-before-kmem_cache_destroy.patch -- To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html