[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <01dfd682-7b3e-c847-3e67-d859db3341cc@users.sourceforge.net>
Date: Fri, 22 Jul 2016 21:51:26 +0200
From: SF Markus Elfring <elfring@...rs.sourceforge.net>
To: linux-block@...r.kernel.org, Jens Axboe <axboe@...nel.dk>
Cc: LKML <linux-kernel@...r.kernel.org>,
kernel-janitors@...r.kernel.org,
Julia Lawall <julia.lawall@...6.fr>
Subject: [PATCH] block: Delete unnecessary checks before the function call
"mempool_destroy"
From: Markus Elfring <elfring@...rs.sourceforge.net>
Date: Fri, 22 Jul 2016 21:45:26 +0200
The mempool_destroy() function tests whether its argument is NULL
and then returns immediately. Thus the test around the calls is not needed.
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring <elfring@...rs.sourceforge.net>
---
block/bio-integrity.c | 7 ++-----
block/bio.c | 8 ++------
block/blk-core.c | 3 +--
3 files changed, 5 insertions(+), 13 deletions(-)
diff --git a/block/bio-integrity.c b/block/bio-integrity.c
index f70cc3b..7506a3e 100644
--- a/block/bio-integrity.c
+++ b/block/bio-integrity.c
@@ -499,11 +499,8 @@ EXPORT_SYMBOL(bioset_integrity_create);
void bioset_integrity_free(struct bio_set *bs)
{
- if (bs->bio_integrity_pool)
- mempool_destroy(bs->bio_integrity_pool);
-
- if (bs->bvec_integrity_pool)
- mempool_destroy(bs->bvec_integrity_pool);
+ mempool_destroy(bs->bio_integrity_pool);
+ mempool_destroy(bs->bvec_integrity_pool);
}
EXPORT_SYMBOL(bioset_integrity_free);
diff --git a/block/bio.c b/block/bio.c
index 54ee384..21a2222 100644
--- a/block/bio.c
+++ b/block/bio.c
@@ -1843,12 +1843,8 @@ void bioset_free(struct bio_set *bs)
if (bs->rescue_workqueue)
destroy_workqueue(bs->rescue_workqueue);
- if (bs->bio_pool)
- mempool_destroy(bs->bio_pool);
-
- if (bs->bvec_pool)
- mempool_destroy(bs->bvec_pool);
-
+ mempool_destroy(bs->bio_pool);
+ mempool_destroy(bs->bvec_pool);
bioset_integrity_free(bs);
bio_put_slab(bs);
diff --git a/block/blk-core.c b/block/blk-core.c
index a687e9c..db8c6b4 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -636,8 +636,7 @@ int blk_init_rl(struct request_list *rl, struct request_queue *q,
void blk_exit_rl(struct request_list *rl)
{
- if (rl->rq_pool)
- mempool_destroy(rl->rq_pool);
+ mempool_destroy(rl->rq_pool);
}
struct request_queue *blk_alloc_queue(gfp_t gfp_mask)
--
2.9.2
Powered by blists - more mailing lists