mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] drivers/block/drbd: remove the null check for kmem_cache_destroy
@ 2018-08-08 15:22 zhong jiang
  2018-08-08 16:04 ` Jens Axboe
  0 siblings, 1 reply; 2+ messages in thread
From: zhong jiang @ 2018-08-08 15:22 UTC (permalink / raw)
  To: axboe, lars.ellenberg; +Cc: linux-kernel

kmem_cache_destroy has taken null pointer into account. So it is
safe to drop the null check before calling the function.

Signed-off-by: zhong jiang <zhongjiang@huawei.com>
---
 drivers/block/drbd/drbd_main.c | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/drivers/block/drbd/drbd_main.c b/drivers/block/drbd/drbd_main.c
index a80809b..ef8212a 100644
--- a/drivers/block/drbd/drbd_main.c
+++ b/drivers/block/drbd/drbd_main.c
@@ -2103,14 +2103,10 @@ static void drbd_destroy_mempools(void)
 	mempool_exit(&drbd_md_io_page_pool);
 	mempool_exit(&drbd_ee_mempool);
 	mempool_exit(&drbd_request_mempool);
-	if (drbd_ee_cache)
-		kmem_cache_destroy(drbd_ee_cache);
-	if (drbd_request_cache)
-		kmem_cache_destroy(drbd_request_cache);
-	if (drbd_bm_ext_cache)
-		kmem_cache_destroy(drbd_bm_ext_cache);
-	if (drbd_al_ext_cache)
-		kmem_cache_destroy(drbd_al_ext_cache);
+	kmem_cache_destroy(drbd_ee_cache);
+	kmem_cache_destroy(drbd_request_cache);
+	kmem_cache_destroy(drbd_bm_ext_cache);
+	kmem_cache_destroy(drbd_al_ext_cache);
 
 	drbd_ee_cache        = NULL;
 	drbd_request_cache   = NULL;
-- 
1.7.12.4


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] drivers/block/drbd: remove the null check for kmem_cache_destroy
  2018-08-08 15:22 [PATCH] drivers/block/drbd: remove the null check for kmem_cache_destroy zhong jiang
@ 2018-08-08 16:04 ` Jens Axboe
  0 siblings, 0 replies; 2+ messages in thread
From: Jens Axboe @ 2018-08-08 16:04 UTC (permalink / raw)
  To: zhong jiang, lars.ellenberg; +Cc: linux-kernel

On 8/8/18 9:22 AM, zhong jiang wrote:
> kmem_cache_destroy has taken null pointer into account. So it is
> safe to drop the null check before calling the function.

Applied, thanks.

-- 
Jens Axboe


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-08-08 16:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-08 15:22 [PATCH] drivers/block/drbd: remove the null check for kmem_cache_destroy zhong jiang
2018-08-08 16:04 ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®