[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <bc309a57-5684-d0f5-b876-a463cb112777@users.sourceforge.net>
Date: Thu, 6 Oct 2016 10:57:44 +0200
From: SF Markus Elfring <elfring@...rs.sourceforge.net>
To: linux-raid@...r.kernel.org, Christoph Hellwig <hch@....de>,
Guoqing Jiang <gqjiang@...e.com>, Jens Axboe <axboe@...com>,
Mike Christie <mchristi@...hat.com>,
Neil Brown <neilb@...e.com>, Shaohua Li <shli@...nel.org>,
Tomasz Majchrzak <tomasz.majchrzak@...el.com>
Cc: LKML <linux-kernel@...r.kernel.org>,
kernel-janitors@...r.kernel.org,
Julia Lawall <julia.lawall@...6.fr>
Subject: [PATCH 05/54] md/raid0: Move another variable assignment in
create_strip_zones()
From: Markus Elfring <elfring@...rs.sourceforge.net>
Date: Tue, 4 Oct 2016 13:54:36 +0200
One local variable was set to an error code before a concrete
error situation was detected. Thus move the corresponding assignment
to the end to indicate a software failure there.
Use it finally in four if branches for exception handling.
Signed-off-by: Markus Elfring <elfring@...rs.sourceforge.net>
---
drivers/md/raid0.c | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/drivers/md/raid0.c b/drivers/md/raid0.c
index 3079c3e..0315f1e 100644
--- a/drivers/md/raid0.c
+++ b/drivers/md/raid0.c
@@ -173,7 +173,6 @@ static int create_strip_zones(struct mddev *mddev, struct r0conf **private_conf)
cnt = 0;
smallest = NULL;
dev = conf->devlist;
- err = -EINVAL;
rdev_for_each(rdev1, mddev) {
int j = rdev1->raid_disk;
@@ -194,17 +193,17 @@ static int create_strip_zones(struct mddev *mddev, struct r0conf **private_conf)
if (j < 0) {
pr_err("%s: remove inactive devices before converting to RAID0\n",
mdname(mddev));
- goto free_device_list;
+ goto e_inval;
}
if (j >= mddev->raid_disks) {
pr_err("%s: bad disk number %d%s",
mdname(mddev), j, " - aborting!\n");
- goto free_device_list;
+ goto e_inval;
}
if (dev[j]) {
pr_err("%s: multiple devices for %d%s",
mdname(mddev), j, " - aborting!\n");
- goto free_device_list;
+ goto e_inval;
}
dev[j] = rdev1;
@@ -215,7 +214,7 @@ static int create_strip_zones(struct mddev *mddev, struct r0conf **private_conf)
if (cnt != mddev->raid_disks) {
pr_err("%s: too few disks (%d of %d)%s",
mdname(mddev), cnt, mddev->raid_disks, " - aborting!\n");
- goto free_device_list;
+ goto e_inval;
}
zone->nb_dev = cnt;
zone->zone_end = smallest->sectors * cnt;
@@ -280,6 +279,9 @@ static int create_strip_zones(struct mddev *mddev, struct r0conf **private_conf)
kfree(conf);
*private_conf = ERR_PTR(err);
return err;
+e_inval:
+ err = -EINVAL;
+ goto free_device_list;
}
/* Find the zone which holds a particular offset
--
2.10.1
Powered by blists - more mailing lists