[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <0e0d240c-a386-25f4-9415-6185aabbcf21@users.sourceforge.net>
Date: Sun, 2 Oct 2016 14:01:06 +0200
From: SF Markus Elfring <elfring@...rs.sourceforge.net>
To: linux-raid@...r.kernel.org, Jens Axboe <axboe@...com>,
NeilBrown <neilb@...e.com>, Shaohua Li <shli@...nel.org>
Cc: LKML <linux-kernel@...r.kernel.org>,
kernel-janitors@...r.kernel.org,
Julia Lawall <julia.lawall@...6.fr>
Subject: [PATCH 5/13] md/multipath: Less function calls in multipath_run()
after error detection
From: Markus Elfring <elfring@...rs.sourceforge.net>
Date: Sat, 1 Oct 2016 21:48:59 +0200
The functions "kfree" and "mempool_destroy" were called in a few cases
by the function "multipath_run" during error handling even if
the passed data structure member contained a null pointer.
Adjust jump targets according to the Linux coding style convention.
Signed-off-by: Markus Elfring <elfring@...rs.sourceforge.net>
---
drivers/md/multipath.c | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/drivers/md/multipath.c b/drivers/md/multipath.c
index 7900426..2e4ceb9 100644
--- a/drivers/md/multipath.c
+++ b/drivers/md/multipath.c
@@ -408,7 +408,7 @@ static int multipath_run (struct mddev *mddev)
sizeof(*conf->multipaths),
GFP_KERNEL);
if (!conf->multipaths)
- goto out_free_conf;
+ goto free_conf;
working_disks = 0;
rdev_for_each(rdev, mddev) {
@@ -434,18 +434,18 @@ static int multipath_run (struct mddev *mddev)
if (!working_disks) {
printk(KERN_ERR "multipath: no operational IO paths for %s\n",
mdname(mddev));
- goto out_free_conf;
+ goto free_multipaths;
}
mddev->degraded = conf->raid_disks - working_disks;
conf->pool = mempool_create_kmalloc_pool(NR_RESERVED_BUFS,
sizeof(struct multipath_bh));
if (!conf->pool)
- goto out_free_conf;
+ goto free_multipaths;
mddev->thread = md_register_thread(multipathd, mddev, "multipath");
if (!mddev->thread)
- goto out_free_conf;
+ goto destroy_pool;
printk(KERN_INFO
"multipath: array %s active with %d out of %d IO paths\n",
@@ -457,13 +457,14 @@ static int multipath_run (struct mddev *mddev)
md_set_array_sectors(mddev, multipath_size(mddev, 0, 0));
if (md_integrity_register(mddev))
- goto out_free_conf;
+ goto destroy_pool;
return 0;
-
-out_free_conf:
+destroy_pool:
mempool_destroy(conf->pool);
+free_multipaths:
kfree(conf->multipaths);
+free_conf:
kfree(conf);
mddev->private = NULL;
out:
--
2.10.0
Powered by blists - more mailing lists