From d18bfbe3d0343ac735a4f35c122de7c48a2915ac Mon Sep 17 00:00:00 2001 From: NeilBrown Date: Thu, 16 Dec 2010 09:07:52 +1100 Subject: [PATCH] Grow: make sure rv is set correctly in reshape_container_raid_disks Whenever there is an error, rv must be -1. Signed-off-by: NeilBrown --- Grow.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Grow.c b/Grow.c index 4257acca..40b4809a 100644 --- a/Grow.c +++ b/Grow.c @@ -692,6 +692,7 @@ static int reshape_container_raid_disks(char *container, int raid_disks) if (!is_container_member(e, container)) continue; + rv = -1; level = map_name(pers, e->level); if (level == 0) { sub = sysfs_read(-1, e->devnum, GET_VERSION); @@ -711,11 +712,10 @@ static int reshape_container_raid_disks(char *container, int raid_disks) sysfs_free(sub); level = 4; } - + rv = -1; sub = NULL; switch (level) { default: - rv = -1; break; case 6: parity_disks++; @@ -740,6 +740,7 @@ static int reshape_container_raid_disks(char *container, int raid_disks) err = errno; break; } + rv = -1; /* fall through */ case 1: if (!sub) -- 2.47.2