Index: firmware/target/arm/as3525/sd-as3525v2.c
===================================================================
--- firmware/target/arm/as3525/sd-as3525v2.c	(revision 29146)
+++ firmware/target/arm/as3525/sd-as3525v2.c	(working copy)
@@ -473,7 +473,9 @@
 
     while (1)
     {
-        while(!(send_cmd(drive, SD_SEND_STATUS, card_info[drive].rca, MCI_RESP, &response)));
+        if(!send_cmd(drive, SD_SEND_STATUS, card_info[drive].rca, MCI_RESP,
+                    &response))
+            return -1;
 
         if (((response >> 9) & 0xf) == SD_TRAN)
             return 0;
@@ -636,7 +638,7 @@
         case SYS_HOTSWAP_INSERTED:
         case SYS_HOTSWAP_EXTRACTED:
         {
-            int microsd_init = 1;
+            int mount_res = 1;
             fat_lock();          /* lock-out FAT activity first -
                                     prevent deadlocking via disk_mount that
                                     would cause a reverse-order attempt with
@@ -654,26 +656,19 @@
             card_info[SD_SLOT_AS3525].initialized = 0;
 
             if (ev.id == SYS_HOTSWAP_INSERTED)
-            {
-                sd_enable(true);
-                microsd_init = sd_init_card(SD_SLOT_AS3525);
-                if (microsd_init < 0) /* initialisation failed */
-                    panicf("microSD init failed : %d", microsd_init);
+                mount_res = disk_mount(SD_SLOT_AS3525); /* 0 if fail */
 
-                microsd_init = disk_mount(SD_SLOT_AS3525); /* 0 if fail */
-            }
-
             /*
              * Mount succeeded, or this was an EXTRACTED event,
              * in both cases notify the system about the changed filesystems
              */
-            if (microsd_init)
+            if (mount_res)
                 queue_broadcast(SYS_FS_CHANGED, 0);
             /* Access is now safe */
+
             mutex_unlock(&sd_mtx);
             fat_unlock();
-            sd_enable(false);
-        }
+            }
             break;
 #endif
         case SYS_TIMEOUT:
@@ -981,6 +976,9 @@
 sd_transfer_error_no_dma:
 
     card_info[drive].initialized = 0;
+
+    sd_enable(false);
+    led(false);
     mutex_unlock(&sd_mtx);
     return ret;
 }
