Manage: Manage_add(): Avoid NULL initialization of dev_st

dev_st is only ever assigned if array->not_persistent == 0, so move
the second use of it into the same scope where the assignment is
made.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
This commit is contained in:
Jes Sorensen 2016-03-09 14:51:03 -05:00
parent 9d1fbf65a5
commit fbd3e15c0a
1 changed files with 12 additions and 13 deletions

View File

@ -738,7 +738,7 @@ int Manage_add(int fd, int tfd, struct mddev_dev *dv,
int raid_slot) int raid_slot)
{ {
unsigned long long ldsize; unsigned long long ldsize;
struct supertype *dev_st = NULL; struct supertype *dev_st;
int j; int j;
mdu_disk_info_t disc; mdu_disk_info_t disc;
@ -843,20 +843,19 @@ int Manage_add(int fd, int tfd, struct mddev_dev *dv,
* simply re-add it. * simply re-add it.
*/ */
if (array->not_persistent==0) { if (array->not_persistent == 0) {
dev_st = dup_super(tst); dev_st = dup_super(tst);
dev_st->ss->load_super(dev_st, tfd, NULL); dev_st->ss->load_super(dev_st, tfd, NULL);
} if (dev_st->sb && dv->disposition != 'S') {
if (dev_st && dev_st->sb && dv->disposition != 'S') { int rv;
int rv = attempt_re_add(fd, tfd, dv,
dev_st, tst, rv = attempt_re_add(fd, tfd, dv, dev_st, tst,
rdev, rdev, update, devname,
update, devname, verbose, array);
verbose, dev_st->ss->free_super(dev_st);
array); if (rv)
dev_st->ss->free_super(dev_st); return rv;
if (rv) }
return rv;
} }
if (dv->disposition == 'M') { if (dv->disposition == 'M') {
if (verbose > 0) if (verbose > 0)