Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1223649 > unrolled thread
| Started by | Julia Lawall <Julia.Lawall@lip6.fr> |
|---|---|
| First post | 2015-09-13 14:40 +0200 |
| Last post | 2015-09-15 11:40 +0200 |
| Articles | 2 — 2 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
[PATCH 17/39] md: drop null test before destroy functions Julia Lawall <Julia.Lawall@lip6.fr> - 2015-09-13 14:40 +0200
Re: [PATCH 17/39] md: drop null test before destroy functions Neil Brown <neilb@suse.com> - 2015-09-15 11:40 +0200
| From | Julia Lawall <Julia.Lawall@lip6.fr> |
|---|---|
| Date | 2015-09-13 14:40 +0200 |
| Subject | [PATCH 17/39] md: drop null test before destroy functions |
| Message-ID | <q8eJB-7J8-23@gated-at.bofh.it> |
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>
---
drivers/md/multipath.c | 3 +--
drivers/md/raid1.c | 6 ++----
drivers/md/raid10.c | 9 +++------
drivers/md/raid5.c | 3 +--
4 files changed, 7 insertions(+), 14 deletions(-)
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index 15ef2c6..09a12d7 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -2271,8 +2271,7 @@ static void shrink_stripes(struct r5conf *conf)
drop_one_stripe(conf))
;
- if (conf->slab_cache)
- kmem_cache_destroy(conf->slab_cache);
+ kmem_cache_destroy(conf->slab_cache);
conf->slab_cache = NULL;
}
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
index 4517f06..5f4f553 100644
--- a/drivers/md/raid1.c
+++ b/drivers/md/raid1.c
@@ -2843,8 +2843,7 @@ static struct r1conf *setup_conf(struct mddev *mddev)
abort:
if (conf) {
- if (conf->r1bio_pool)
- mempool_destroy(conf->r1bio_pool);
+ mempool_destroy(conf->r1bio_pool);
kfree(conf->mirrors);
safe_put_page(conf->tmppage);
kfree(conf->poolinfo);
@@ -2946,8 +2945,7 @@ static void raid1_free(struct mddev *mddev, void *priv)
{
struct r1conf *conf = priv;
- if (conf->r1bio_pool)
- mempool_destroy(conf->r1bio_pool);
+ mempool_destroy(conf->r1bio_pool);
kfree(conf->mirrors);
safe_put_page(conf->tmppage);
kfree(conf->poolinfo);
diff --git a/drivers/md/multipath.c b/drivers/md/multipath.c
index d222522..d132f06 100644
--- a/drivers/md/multipath.c
+++ b/drivers/md/multipath.c
@@ -470,8 +470,7 @@ static int multipath_run (struct mddev *mddev)
return 0;
out_free_conf:
- if (conf->pool)
- mempool_destroy(conf->pool);
+ mempool_destroy(conf->pool);
kfree(conf->multipaths);
kfree(conf);
mddev->private = NULL;
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
index 0fc33eb..7c99a40 100644
--- a/drivers/md/raid10.c
+++ b/drivers/md/raid10.c
@@ -3486,8 +3486,7 @@ static struct r10conf *setup_conf(struct mddev *mddev)
printk(KERN_ERR "md/raid10:%s: couldn't allocate memory.\n",
mdname(mddev));
if (conf) {
- if (conf->r10bio_pool)
- mempool_destroy(conf->r10bio_pool);
+ mempool_destroy(conf->r10bio_pool);
kfree(conf->mirrors);
safe_put_page(conf->tmppage);
kfree(conf);
@@ -3682,8 +3681,7 @@ static int run(struct mddev *mddev)
out_free_conf:
md_unregister_thread(&mddev->thread);
- if (conf->r10bio_pool)
- mempool_destroy(conf->r10bio_pool);
+ mempool_destroy(conf->r10bio_pool);
safe_put_page(conf->tmppage);
kfree(conf->mirrors);
kfree(conf);
@@ -3696,8 +3694,7 @@ static void raid10_free(struct mddev *mddev, void *priv)
{
struct r10conf *conf = priv;
- if (conf->r10bio_pool)
- mempool_destroy(conf->r10bio_pool);
+ mempool_destroy(conf->r10bio_pool);
safe_put_page(conf->tmppage);
kfree(conf->mirrors);
kfree(conf->mirrors_old);
--
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/
[toc] | [next] | [standalone]
| From | Neil Brown <neilb@suse.com> |
|---|---|
| Date | 2015-09-15 11:40 +0200 |
| Message-ID | <q8USt-QT-13@gated-at.bofh.it> |
| In reply to | #1223649 |
[Multipart message — attachments visible in raw view] — view raw
Julia Lawall <Julia.Lawall@lip6.fr> writes:
> 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>
>
> ---
> drivers/md/multipath.c | 3 +--
> drivers/md/raid1.c | 6 ++----
> drivers/md/raid10.c | 9 +++------
> drivers/md/raid5.c | 3 +--
> 4 files changed, 7 insertions(+), 14 deletions(-)
Applied, thanks.
NeilBrown
>
> diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
> index 15ef2c6..09a12d7 100644
> --- a/drivers/md/raid5.c
> +++ b/drivers/md/raid5.c
> @@ -2271,8 +2271,7 @@ static void shrink_stripes(struct r5conf *conf)
> drop_one_stripe(conf))
> ;
>
> - if (conf->slab_cache)
> - kmem_cache_destroy(conf->slab_cache);
> + kmem_cache_destroy(conf->slab_cache);
> conf->slab_cache = NULL;
> }
>
> diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
> index 4517f06..5f4f553 100644
> --- a/drivers/md/raid1.c
> +++ b/drivers/md/raid1.c
> @@ -2843,8 +2843,7 @@ static struct r1conf *setup_conf(struct mddev *mddev)
>
> abort:
> if (conf) {
> - if (conf->r1bio_pool)
> - mempool_destroy(conf->r1bio_pool);
> + mempool_destroy(conf->r1bio_pool);
> kfree(conf->mirrors);
> safe_put_page(conf->tmppage);
> kfree(conf->poolinfo);
> @@ -2946,8 +2945,7 @@ static void raid1_free(struct mddev *mddev, void *priv)
> {
> struct r1conf *conf = priv;
>
> - if (conf->r1bio_pool)
> - mempool_destroy(conf->r1bio_pool);
> + mempool_destroy(conf->r1bio_pool);
> kfree(conf->mirrors);
> safe_put_page(conf->tmppage);
> kfree(conf->poolinfo);
> diff --git a/drivers/md/multipath.c b/drivers/md/multipath.c
> index d222522..d132f06 100644
> --- a/drivers/md/multipath.c
> +++ b/drivers/md/multipath.c
> @@ -470,8 +470,7 @@ static int multipath_run (struct mddev *mddev)
> return 0;
>
> out_free_conf:
> - if (conf->pool)
> - mempool_destroy(conf->pool);
> + mempool_destroy(conf->pool);
> kfree(conf->multipaths);
> kfree(conf);
> mddev->private = NULL;
> diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
> index 0fc33eb..7c99a40 100644
> --- a/drivers/md/raid10.c
> +++ b/drivers/md/raid10.c
> @@ -3486,8 +3486,7 @@ static struct r10conf *setup_conf(struct mddev *mddev)
> printk(KERN_ERR "md/raid10:%s: couldn't allocate memory.\n",
> mdname(mddev));
> if (conf) {
> - if (conf->r10bio_pool)
> - mempool_destroy(conf->r10bio_pool);
> + mempool_destroy(conf->r10bio_pool);
> kfree(conf->mirrors);
> safe_put_page(conf->tmppage);
> kfree(conf);
> @@ -3682,8 +3681,7 @@ static int run(struct mddev *mddev)
>
> out_free_conf:
> md_unregister_thread(&mddev->thread);
> - if (conf->r10bio_pool)
> - mempool_destroy(conf->r10bio_pool);
> + mempool_destroy(conf->r10bio_pool);
> safe_put_page(conf->tmppage);
> kfree(conf->mirrors);
> kfree(conf);
> @@ -3696,8 +3694,7 @@ static void raid10_free(struct mddev *mddev, void *priv)
> {
> struct r10conf *conf = priv;
>
> - if (conf->r10bio_pool)
> - mempool_destroy(conf->r10bio_pool);
> + mempool_destroy(conf->r10bio_pool);
> safe_put_page(conf->tmppage);
> kfree(conf->mirrors);
> kfree(conf->mirrors_old);
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web