From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755732AbbIMMe0 (ORCPT ); Sun, 13 Sep 2015 08:34:26 -0400 Received: from mail3-relais-sop.national.inria.fr ([192.134.164.104]:60466 "EHLO mail3-relais-sop.national.inria.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753436AbbIMM0D (ORCPT ); Sun, 13 Sep 2015 08:26:03 -0400 X-IronPort-AV: E=Sophos;i="5.17,522,1437429600"; d="scan'208";a="145607434" From: Julia Lawall To: Oleg Drokin Cc: sergey.senozhatsky@gmail.com, kernel-janitors@vger.kernel.org, Andreas Dilger , Greg Kroah-Hartman , HPDD-discuss@ml01.01.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Subject: [PATCH 13/39] staging: lustre: drop null test before destroy functions Date: Sun, 13 Sep 2015 14:15:06 +0200 Message-Id: <1442146532-9100-14-git-send-email-Julia.Lawall@lip6.fr> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1442146532-9100-1-git-send-email-Julia.Lawall@lip6.fr> References: <1442146532-9100-1-git-send-email-Julia.Lawall@lip6.fr> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Remove unneeded NULL test. The semantic patch that makes this change is as follows: (http://coccinelle.lip6.fr/) // @@ expression x; @@ -if (x != NULL) \(kmem_cache_destroy\|mempool_destroy\|dma_pool_destroy\)(x); @@ expression x; @@ -if (x != NULL) { \(kmem_cache_destroy\|mempool_destroy\|dma_pool_destroy\)(x); x = NULL; -} // Signed-off-by: Julia Lawall --- drivers/staging/lustre/lustre/llite/super25.c | 16 +++----------- drivers/staging/lustre/lustre/obdclass/genops.c | 24 +++++++-------------- drivers/staging/lustre/lustre/obdclass/lu_object.c | 6 +---- 3 files changed, 14 insertions(+), 32 deletions(-) diff --git a/drivers/staging/lustre/lustre/obdclass/lu_object.c b/drivers/staging/lustre/lustre/obdclass/lu_object.c index 8e47232..e8101fe 100644 --- a/drivers/staging/lustre/lustre/obdclass/lu_object.c +++ b/drivers/staging/lustre/lustre/obdclass/lu_object.c @@ -2052,10 +2052,8 @@ EXPORT_SYMBOL(lu_kmem_init); void lu_kmem_fini(struct lu_kmem_descr *caches) { for (; caches->ckd_cache != NULL; ++caches) { - if (*caches->ckd_cache != NULL) { - kmem_cache_destroy(*caches->ckd_cache); - *caches->ckd_cache = NULL; - } + kmem_cache_destroy(*caches->ckd_cache); + *caches->ckd_cache = NULL; } } EXPORT_SYMBOL(lu_kmem_fini); diff --git a/drivers/staging/lustre/lustre/obdclass/genops.c b/drivers/staging/lustre/lustre/obdclass/genops.c index 0ca7309..ad78a04 100644 --- a/drivers/staging/lustre/lustre/obdclass/genops.c +++ b/drivers/staging/lustre/lustre/obdclass/genops.c @@ -638,22 +638,14 @@ EXPORT_SYMBOL(class_notify_sptlrpc_conf); void obd_cleanup_caches(void) { - if (obd_device_cachep) { - kmem_cache_destroy(obd_device_cachep); - obd_device_cachep = NULL; - } - if (obdo_cachep) { - kmem_cache_destroy(obdo_cachep); - obdo_cachep = NULL; - } - if (import_cachep) { - kmem_cache_destroy(import_cachep); - import_cachep = NULL; - } - if (capa_cachep) { - kmem_cache_destroy(capa_cachep); - capa_cachep = NULL; - } + kmem_cache_destroy(obd_device_cachep); + obd_device_cachep = NULL; + kmem_cache_destroy(obdo_cachep); + obdo_cachep = NULL; + kmem_cache_destroy(import_cachep); + import_cachep = NULL; + kmem_cache_destroy(capa_cachep); + capa_cachep = NULL; } int obd_init_caches(void) diff --git a/drivers/staging/lustre/lustre/llite/super25.c b/drivers/staging/lustre/lustre/llite/super25.c index e4020ce..4cf7af2 100644 --- a/drivers/staging/lustre/lustre/llite/super25.c +++ b/drivers/staging/lustre/lustre/llite/super25.c @@ -183,18 +183,10 @@ out_sysfs: out_debugfs: debugfs_remove(llite_root); out_cache: - if (ll_inode_cachep != NULL) - kmem_cache_destroy(ll_inode_cachep); - - if (ll_file_data_slab != NULL) - kmem_cache_destroy(ll_file_data_slab); - - if (ll_remote_perm_cachep != NULL) - kmem_cache_destroy(ll_remote_perm_cachep); - - if (ll_rmtperm_hash_cachep != NULL) - kmem_cache_destroy(ll_rmtperm_hash_cachep); - + kmem_cache_destroy(ll_inode_cachep); + kmem_cache_destroy(ll_file_data_slab); + kmem_cache_destroy(ll_remote_perm_cachep); + kmem_cache_destroy(ll_rmtperm_hash_cachep); return rc; } From mboxrd@z Thu Jan 1 00:00:00 1970 From: Julia Lawall Date: Sun, 13 Sep 2015 12:15:06 +0000 Subject: [PATCH 13/39] staging: lustre: drop null test before destroy functions Message-Id: <1442146532-9100-14-git-send-email-Julia.Lawall@lip6.fr> List-Id: References: <1442146532-9100-1-git-send-email-Julia.Lawall@lip6.fr> In-Reply-To: <1442146532-9100-1-git-send-email-Julia.Lawall@lip6.fr> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Oleg Drokin Cc: sergey.senozhatsky@gmail.com, kernel-janitors@vger.kernel.org, Andreas Dilger , Greg Kroah-Hartman , HPDD-discuss@ml01.01.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Remove unneeded NULL test. The semantic patch that makes this change is as follows: (http://coccinelle.lip6.fr/) // @@ expression x; @@ -if (x != NULL) \(kmem_cache_destroy\|mempool_destroy\|dma_pool_destroy\)(x); @@ expression x; @@ -if (x != NULL) { \(kmem_cache_destroy\|mempool_destroy\|dma_pool_destroy\)(x); x = NULL; -} // Signed-off-by: Julia Lawall --- drivers/staging/lustre/lustre/llite/super25.c | 16 +++----------- drivers/staging/lustre/lustre/obdclass/genops.c | 24 +++++++-------------- drivers/staging/lustre/lustre/obdclass/lu_object.c | 6 +---- 3 files changed, 14 insertions(+), 32 deletions(-) diff --git a/drivers/staging/lustre/lustre/obdclass/lu_object.c b/drivers/staging/lustre/lustre/obdclass/lu_object.c index 8e47232..e8101fe 100644 --- a/drivers/staging/lustre/lustre/obdclass/lu_object.c +++ b/drivers/staging/lustre/lustre/obdclass/lu_object.c @@ -2052,10 +2052,8 @@ EXPORT_SYMBOL(lu_kmem_init); void lu_kmem_fini(struct lu_kmem_descr *caches) { for (; caches->ckd_cache != NULL; ++caches) { - if (*caches->ckd_cache != NULL) { - kmem_cache_destroy(*caches->ckd_cache); - *caches->ckd_cache = NULL; - } + kmem_cache_destroy(*caches->ckd_cache); + *caches->ckd_cache = NULL; } } EXPORT_SYMBOL(lu_kmem_fini); diff --git a/drivers/staging/lustre/lustre/obdclass/genops.c b/drivers/staging/lustre/lustre/obdclass/genops.c index 0ca7309..ad78a04 100644 --- a/drivers/staging/lustre/lustre/obdclass/genops.c +++ b/drivers/staging/lustre/lustre/obdclass/genops.c @@ -638,22 +638,14 @@ EXPORT_SYMBOL(class_notify_sptlrpc_conf); void obd_cleanup_caches(void) { - if (obd_device_cachep) { - kmem_cache_destroy(obd_device_cachep); - obd_device_cachep = NULL; - } - if (obdo_cachep) { - kmem_cache_destroy(obdo_cachep); - obdo_cachep = NULL; - } - if (import_cachep) { - kmem_cache_destroy(import_cachep); - import_cachep = NULL; - } - if (capa_cachep) { - kmem_cache_destroy(capa_cachep); - capa_cachep = NULL; - } + kmem_cache_destroy(obd_device_cachep); + obd_device_cachep = NULL; + kmem_cache_destroy(obdo_cachep); + obdo_cachep = NULL; + kmem_cache_destroy(import_cachep); + import_cachep = NULL; + kmem_cache_destroy(capa_cachep); + capa_cachep = NULL; } int obd_init_caches(void) diff --git a/drivers/staging/lustre/lustre/llite/super25.c b/drivers/staging/lustre/lustre/llite/super25.c index e4020ce..4cf7af2 100644 --- a/drivers/staging/lustre/lustre/llite/super25.c +++ b/drivers/staging/lustre/lustre/llite/super25.c @@ -183,18 +183,10 @@ out_sysfs: out_debugfs: debugfs_remove(llite_root); out_cache: - if (ll_inode_cachep != NULL) - kmem_cache_destroy(ll_inode_cachep); - - if (ll_file_data_slab != NULL) - kmem_cache_destroy(ll_file_data_slab); - - if (ll_remote_perm_cachep != NULL) - kmem_cache_destroy(ll_remote_perm_cachep); - - if (ll_rmtperm_hash_cachep != NULL) - kmem_cache_destroy(ll_rmtperm_hash_cachep); - + kmem_cache_destroy(ll_inode_cachep); + kmem_cache_destroy(ll_file_data_slab); + kmem_cache_destroy(ll_remote_perm_cachep); + kmem_cache_destroy(ll_rmtperm_hash_cachep); return rc; }