Commit 644df1a8 authored by Julia Lawall's avatar Julia Lawall Committed by NeilBrown

md: drop null test before destroy functions

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: default avatarJulia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: default avatarNeilBrown <neilb@suse.com>
parent d4929add
...@@ -470,7 +470,6 @@ static int multipath_run (struct mddev *mddev) ...@@ -470,7 +470,6 @@ static int multipath_run (struct mddev *mddev)
return 0; return 0;
out_free_conf: out_free_conf:
if (conf->pool)
mempool_destroy(conf->pool); mempool_destroy(conf->pool);
kfree(conf->multipaths); kfree(conf->multipaths);
kfree(conf); kfree(conf);
......
...@@ -2843,7 +2843,6 @@ static struct r1conf *setup_conf(struct mddev *mddev) ...@@ -2843,7 +2843,6 @@ static struct r1conf *setup_conf(struct mddev *mddev)
abort: abort:
if (conf) { if (conf) {
if (conf->r1bio_pool)
mempool_destroy(conf->r1bio_pool); mempool_destroy(conf->r1bio_pool);
kfree(conf->mirrors); kfree(conf->mirrors);
safe_put_page(conf->tmppage); safe_put_page(conf->tmppage);
...@@ -2946,7 +2945,6 @@ static void raid1_free(struct mddev *mddev, void *priv) ...@@ -2946,7 +2945,6 @@ static void raid1_free(struct mddev *mddev, void *priv)
{ {
struct r1conf *conf = priv; struct r1conf *conf = priv;
if (conf->r1bio_pool)
mempool_destroy(conf->r1bio_pool); mempool_destroy(conf->r1bio_pool);
kfree(conf->mirrors); kfree(conf->mirrors);
safe_put_page(conf->tmppage); safe_put_page(conf->tmppage);
......
...@@ -3486,7 +3486,6 @@ static struct r10conf *setup_conf(struct mddev *mddev) ...@@ -3486,7 +3486,6 @@ static struct r10conf *setup_conf(struct mddev *mddev)
printk(KERN_ERR "md/raid10:%s: couldn't allocate memory.\n", printk(KERN_ERR "md/raid10:%s: couldn't allocate memory.\n",
mdname(mddev)); mdname(mddev));
if (conf) { if (conf) {
if (conf->r10bio_pool)
mempool_destroy(conf->r10bio_pool); mempool_destroy(conf->r10bio_pool);
kfree(conf->mirrors); kfree(conf->mirrors);
safe_put_page(conf->tmppage); safe_put_page(conf->tmppage);
...@@ -3682,7 +3681,6 @@ static int run(struct mddev *mddev) ...@@ -3682,7 +3681,6 @@ static int run(struct mddev *mddev)
out_free_conf: out_free_conf:
md_unregister_thread(&mddev->thread); md_unregister_thread(&mddev->thread);
if (conf->r10bio_pool)
mempool_destroy(conf->r10bio_pool); mempool_destroy(conf->r10bio_pool);
safe_put_page(conf->tmppage); safe_put_page(conf->tmppage);
kfree(conf->mirrors); kfree(conf->mirrors);
...@@ -3696,7 +3694,6 @@ static void raid10_free(struct mddev *mddev, void *priv) ...@@ -3696,7 +3694,6 @@ static void raid10_free(struct mddev *mddev, void *priv)
{ {
struct r10conf *conf = priv; struct r10conf *conf = priv;
if (conf->r10bio_pool)
mempool_destroy(conf->r10bio_pool); mempool_destroy(conf->r10bio_pool);
safe_put_page(conf->tmppage); safe_put_page(conf->tmppage);
kfree(conf->mirrors); kfree(conf->mirrors);
......
...@@ -2271,7 +2271,6 @@ static void shrink_stripes(struct r5conf *conf) ...@@ -2271,7 +2271,6 @@ static void shrink_stripes(struct r5conf *conf)
drop_one_stripe(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; conf->slab_cache = NULL;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment