summaryrefslogtreecommitdiff
path: root/firmware
diff options
context:
space:
mode:
Diffstat (limited to 'firmware')
-rw-r--r--firmware/drivers/ata.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/firmware/drivers/ata.c b/firmware/drivers/ata.c
index c2a02cb03c..523b080ec8 100644
--- a/firmware/drivers/ata.c
+++ b/firmware/drivers/ata.c
@@ -204,6 +204,7 @@ int ata_read_sectors(unsigned long start,
204 buf = inbuf; 204 buf = inbuf;
205 count = incount; 205 count = incount;
206 while (TIME_BEFORE(current_tick, timeout)) { 206 while (TIME_BEFORE(current_tick, timeout)) {
207 ret = 0;
207 208
208 if ( count == 256 ) 209 if ( count == 256 )
209 ATA_NSECTOR = 0; /* 0 means 256 sectors */ 210 ATA_NSECTOR = 0; /* 0 means 256 sectors */
@@ -276,15 +277,14 @@ int ata_read_sectors(unsigned long start,
276 ret = -3; 277 ret = -3;
277 goto retry; 278 goto retry;
278 } 279 }
279
280 ret = 0;
281 break; 280 break;
282 } 281 }
283 led(false); 282 led(false);
284 283
285 mutex_unlock(&ata_mtx); 284 mutex_unlock(&ata_mtx);
286 285
287 if ( delayed_write ) 286 /* only flush if reading went ok */
287 if ( (ret == 0) && delayed_write )
288 ata_flush(); 288 ata_flush();
289 289
290 return ret; 290 return ret;
@@ -373,7 +373,8 @@ int ata_write_sectors(unsigned long start,
373 373
374 mutex_unlock(&ata_mtx); 374 mutex_unlock(&ata_mtx);
375 375
376 if ( delayed_write ) 376 /* only flush if writing went ok */
377 if ( (ret == 0) && delayed_write )
377 ata_flush(); 378 ata_flush();
378 379
379 return ret; 380 return ret;