summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--firmware/target/arm/as3525/ata_sd_as3525.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/firmware/target/arm/as3525/ata_sd_as3525.c b/firmware/target/arm/as3525/ata_sd_as3525.c
index 470efa56ab..ae3d466abf 100644
--- a/firmware/target/arm/as3525/ata_sd_as3525.c
+++ b/firmware/target/arm/as3525/ata_sd_as3525.c
@@ -753,17 +753,21 @@ static int sd_transfer_sectors(IF_MV2(int drive,) unsigned long start,
}
}
+ ret = 0; /* success */
+
+sd_transfer_error:
+
dma_release();
#ifndef BOOTLOADER
led(false);
sd_enable(false);
#endif
- mutex_unlock(&sd_mtx);
- return 0;
-sd_transfer_error:
- card_info[drive].initialized = 0;
+ if (ret) /* error */
+ card_info[drive].initialized = 0;
+
+ mutex_unlock(&sd_mtx);
return ret;
}