vold: set state back to idle on formatting error

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
diff --git a/Volume.cpp b/Volume.cpp
index 2f3cad5..4ac086b 100644
--- a/Volume.cpp
+++ b/Volume.cpp
@@ -213,6 +213,7 @@
     }
     setState(Volume::State_Formatting);
 
+    int ret = -1;
     if (initializeMbr(devicePath)) {
         SLOGE("Failed to initialize MBR (%s)", strerror(errno));
         goto err;
@@ -226,10 +227,11 @@
         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) {