Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1223664
| From | Julia Lawall <Julia.Lawall@lip6.fr> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 30/39] block: drop null test before destroy functions |
| Date | 2015-09-13 14:40 +0200 |
| Message-ID | <q8eJC-7J8-57@gated-at.bofh.it> (permalink) |
| References | <q8ezT-7xJ-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
Remove unneeded NULL test.
The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)
// <smpl>
@@ expression x; @@
-if (x != NULL)
\(kmem_cache_destroy\|mempool_destroy\|dma_pool_destroy\)(x);
// </smpl>
Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
---
block/bio-integrity.c | 7 ++-----
block/bio.c | 7 ++-----
block/blk-core.c | 3 +--
block/elevator.c | 3 +--
4 files changed, 6 insertions(+), 14 deletions(-)
diff --git a/block/elevator.c b/block/elevator.c
index 84d6394..e3e9021 100644
--- a/block/elevator.c
+++ b/block/elevator.c
@@ -847,8 +847,7 @@ int elv_register(struct elevator_type *e)
spin_lock(&elv_list_lock);
if (elevator_find(e->elevator_name)) {
spin_unlock(&elv_list_lock);
- if (e->icq_cache)
- kmem_cache_destroy(e->icq_cache);
+ kmem_cache_destroy(e->icq_cache);
return -EBUSY;
}
list_add_tail(&e->list, &elv_list);
diff --git a/block/bio.c b/block/bio.c
index ad3f276..aee3290 100644
--- a/block/bio.c
+++ b/block/bio.c
@@ -1850,11 +1850,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 2eb722d..7dbebd9 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -619,8 +619,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)
diff --git a/block/bio-integrity.c b/block/bio-integrity.c
index 4aecca7..d3e3046 100644
--- a/block/bio-integrity.c
+++ b/block/bio-integrity.c
@@ -490,11 +490,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);
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 00/39] drop null test before destroy functions Julia Lawall <Julia.Lawall@lip6.fr> - 2015-09-13 14:40 +0200
[PATCH 04/39] debugobjects: drop null test before destroy functions Julia Lawall <Julia.Lawall@lip6.fr> - 2015-09-13 14:40 +0200
[PATCH 18/39] whci: drop null test before destroy functions Julia Lawall <Julia.Lawall@lip6.fr> - 2015-09-13 14:40 +0200
[PATCH 05/39] xhci: drop null test before destroy functions Julia Lawall <Julia.Lawall@lip6.fr> - 2015-09-13 14:40 +0200
[PATCH 27/39] ocfs2: drop null test before destroy functions Julia Lawall <Julia.Lawall@lip6.fr> - 2015-09-13 14:40 +0200
[PATCH 28/39] ecryptfs: drop null test before destroy functions Julia Lawall <Julia.Lawall@lip6.fr> - 2015-09-13 14:40 +0200
Re: [PATCH 28/39] ecryptfs: drop null test before destroy functions Tyler Hicks <tyhicks@canonical.com> - 2015-09-15 04:10 +0200
Re: [PATCH 28/39] ecryptfs: drop null test before destroy functions Julia Lawall <julia.lawall@lip6.fr> - 2015-09-15 06:40 +0200
Re: [PATCH 28/39] ecryptfs: drop null test before destroy functions Tyler Hicks <tyhicks@canonical.com> - 2015-09-15 16:50 +0200
[PATCH 07/39] fs: ext4: drop null test before destroy functions Julia Lawall <Julia.Lawall@lip6.fr> - 2015-09-13 14:40 +0200
[PATCH 30/39] block: drop null test before destroy functions Julia Lawall <Julia.Lawall@lip6.fr> - 2015-09-13 14:40 +0200
[PATCH 13/39] staging: lustre: drop null test before destroy functions Julia Lawall <Julia.Lawall@lip6.fr> - 2015-09-13 14:40 +0200
[PATCH 29/39] thunderbolt: drop null test before destroy functions Julia Lawall <Julia.Lawall@lip6.fr> - 2015-09-13 14:40 +0200
Re: [PATCH 00/39] drop null test before destroy functions SF Markus Elfring <elfring@users.sourceforge.net> - 2015-09-14 14:00 +0200
csiph-web