summaryrefslogtreecommitdiffstats
path: root/firmware/target/arm/imx233/sdmmc-imx233.c
diff options
context:
space:
mode:
authorAmaury Pouly <amaury.pouly@gmail.com>2014-04-23 23:43:27 +0200
committerAmaury Pouly <amaury.pouly@gmail.com>2014-04-23 23:43:27 +0200
commit54dd77a5f83a0d923e62b782104d69a769f59dbe (patch)
tree7919a2fd94d234c8f7203c6f9775d34a6164d8e9 /firmware/target/arm/imx233/sdmmc-imx233.c
parent532b8141ab24f386e35f389277b4f3bc67211ed5 (diff)
downloadrockbox-54dd77a5f83a0d923e62b782104d69a769f59dbe.tar.gz
rockbox-54dd77a5f83a0d923e62b782104d69a769f59dbe.tar.bz2
rockbox-54dd77a5f83a0d923e62b782104d69a769f59dbe.zip
imx233: fix sdmmc driver bug when sector count is 0
Since the driver will read count-1 sectors, this will stuck the card. Change-Id: Ib80484044acd1fad2914d3ffeb3940a13d2480c4
Diffstat (limited to 'firmware/target/arm/imx233/sdmmc-imx233.c')
-rw-r--r--firmware/target/arm/imx233/sdmmc-imx233.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/firmware/target/arm/imx233/sdmmc-imx233.c b/firmware/target/arm/imx233/sdmmc-imx233.c
index dbca78be79..e42842d3f7 100644
--- a/firmware/target/arm/imx233/sdmmc-imx233.c
+++ b/firmware/target/arm/imx233/sdmmc-imx233.c
@@ -596,6 +596,9 @@ static int __xfer_sectors(int drive, unsigned long start, int count, void *buf,
static int transfer_sectors(int drive, unsigned long start, int count, void *buf, bool read)
{
int ret = 0;
+ // the function doesn't work when count is 0
+ if(count == 0)
+ return ret;
/* update disk activity */
disk_last_activity[drive] = current_tick;