Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 990a8baf authored by Jesper Juhl's avatar Jesper Juhl Committed by Linus Torvalds
Browse files

[PATCH] md: remove unneeded NULL checks before kfree



This patch removes some unneeded checks of pointers being NULL before
calling kfree() on them.  kfree() handles NULL pointers just fine, checking
first is pointless.

Signed-off-by: default avatarJesper Juhl <juhl-lkml@dif.dk>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 8a5e9cf1
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -704,7 +704,6 @@ static void crypt_dtr(struct dm_target *ti)
	mempool_destroy(cc->page_pool);
	mempool_destroy(cc->io_pool);

	if (cc->iv_mode)
	kfree(cc->iv_mode);
	if (cc->iv_gen_ops && cc->iv_gen_ops->dtr)
		cc->iv_gen_ops->dtr(cc);
+1 −2
Original line number Diff line number Diff line
@@ -217,7 +217,6 @@ static int linear_run (mddev_t *mddev)
	return 0;

out:
	if (conf)
	kfree(conf);
	return 1;
}
+3 −7
Original line number Diff line number Diff line
@@ -195,7 +195,6 @@ static mddev_t * mddev_find(dev_t unit)
		if (mddev->unit == unit) {
			mddev_get(mddev);
			spin_unlock(&all_mddevs_lock);
			if (new)
			kfree(new);
			return mddev;
		}
@@ -458,11 +457,8 @@ static int sb_equal(mdp_super_t *sb1, mdp_super_t *sb2)
		ret = 1;

abort:
	if (tmp1)
	kfree(tmp1);
	if (tmp2)
	kfree(tmp2);

	return ret;
}

+1 −2
Original line number Diff line number Diff line
@@ -533,7 +533,6 @@ static int multipath_run (mddev_t *mddev)
out_free_conf:
	if (conf->pool)
		mempool_destroy(conf->pool);
	if (conf->multipaths)
	kfree(conf->multipaths);
	kfree(conf);
	mddev->private = NULL;
+5 −7
Original line number Diff line number Diff line
@@ -371,9 +371,7 @@ static int raid0_run (mddev_t *mddev)
	return 0;

out_free_conf:
	if (conf->strip_zone)
	kfree(conf->strip_zone);
	if (conf->devlist)
	kfree(conf->devlist);
	kfree(conf);
	mddev->private = NULL;
Loading