On formatting error due to some reasons, the state is left at
Formatting, therefore the user is unable to mount the sdcard
again. The patch sets the state to Idle no matter formatting
error or not.
Change-Id: I62c78eb8299cc397ee5cc442890f8b3dbf09425c
}
setState(Volume::State_Formatting);
+ int ret = -1;
if (initializeMbr(devicePath)) {
SLOGE("Failed to initialize MBR (%s)", strerror(errno));
goto err;
goto err;
}
- setState(Volume::State_Idle);
- return 0;
+ ret = 0;
+
err:
- return -1;
+ setState(Volume::State_Idle);
+ return ret;
}
bool Volume::isMountpointMounted(const char *path) {