[PATCH 43/54] md/raid10: Return directly after detection of unsupported settings in setup_conf()

From: SF Markus Elfring
Date: Thu Oct 06 2016 - 05:44:10 EST


From: Markus Elfring <elfring@xxxxxxxxxxxxxxxxxxxxx>
Date: Wed, 5 Oct 2016 17:32:49 +0200

* Return directly after unsupported system settings were detected
at the beginning.

* Delete the explicit initialisation for the local variables "conf"
and "err" which became unnecessary with this refactoring.

Signed-off-by: Markus Elfring <elfring@xxxxxxxxxxxxxxxxxxxxx>
---
drivers/md/raid10.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
index 1f712f7..8326e68 100644
--- a/drivers/md/raid10.c
+++ b/drivers/md/raid10.c
@@ -3478,8 +3478,8 @@ static int setup_geo(struct geom *geo, struct mddev *mddev, enum geo_type new)

static struct r10conf *setup_conf(struct mddev *mddev)
{
- struct r10conf *conf = NULL;
- int err = -EINVAL;
+ struct r10conf *conf;
+ int err;
struct geom geo;
int copies;

@@ -3489,13 +3489,13 @@ static struct r10conf *setup_conf(struct mddev *mddev)
printk(KERN_ERR "md/raid10:%s: chunk size must be "
"at least PAGE_SIZE(%ld) and be a power of 2.\n",
mdname(mddev), PAGE_SIZE);
- goto out;
+ return ERR_PTR(-EINVAL);
}

if (copies < 2 || copies > mddev->raid_disks) {
printk(KERN_ERR "md/raid10:%s: unsupported raid10 layout: 0x%8x\n",
mdname(mddev), mddev->new_layout);
- goto out;
+ return ERR_PTR(-EINVAL);
}

err = -ENOMEM;
--
2.10.1