1
0
Fork 0
forked from len0rd/rockbox

Initialize return code at start of loop, not at the end.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@3440 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Björn Stenberg 2003-03-13 15:45:38 +00:00
parent 1609d6b486
commit b12401b4d4

View file

@ -204,6 +204,7 @@ int ata_read_sectors(unsigned long start,
buf = inbuf; buf = inbuf;
count = incount; count = incount;
while (TIME_BEFORE(current_tick, timeout)) { while (TIME_BEFORE(current_tick, timeout)) {
ret = 0;
if ( count == 256 ) if ( count == 256 )
ATA_NSECTOR = 0; /* 0 means 256 sectors */ ATA_NSECTOR = 0; /* 0 means 256 sectors */
@ -276,15 +277,14 @@ int ata_read_sectors(unsigned long start,
ret = -3; ret = -3;
goto retry; goto retry;
} }
ret = 0;
break; break;
} }
led(false); led(false);
mutex_unlock(&ata_mtx); mutex_unlock(&ata_mtx);
if ( delayed_write ) /* only flush if reading went ok */
if ( (ret == 0) && delayed_write )
ata_flush(); ata_flush();
return ret; return ret;
@ -373,7 +373,8 @@ int ata_write_sectors(unsigned long start,
mutex_unlock(&ata_mtx); mutex_unlock(&ata_mtx);
if ( delayed_write ) /* only flush if writing went ok */
if ( (ret == 0) && delayed_write )
ata_flush(); ata_flush();
return ret; return ret;