]> err.no Git - linux-2.6/commitdiff
ide: check BUSY and ERROR status bits before reading data in drive_cmd_intr()
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Sat, 26 Jan 2008 19:13:12 +0000 (20:13 +0100)
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Sat, 26 Jan 2008 19:13:12 +0000 (20:13 +0100)
Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
drivers/ide/ide-io.c

index dc6af24a97d911010b15c75a1764fd383fb9d1a4..ce8ab1085936cabeed5ea5237376cfe25a5f016c 100644 (file)
@@ -643,8 +643,13 @@ static ide_startstop_t drive_cmd_intr (ide_drive_t *drive)
        if (pio_in) {
                u8 io_32bit = drive->io_32bit;
                stat = hwif->INB(IDE_STATUS_REG);
-               if ((stat & DRQ_STAT) == 0)
-                       goto out;
+               if (!OK_STAT(stat, DRQ_STAT, BAD_R_STAT)) {
+                       if (stat & (ERR_STAT | DRQ_STAT))
+                               return ide_error(drive, __FUNCTION__, stat);
+                       ide_set_handler(drive, &drive_cmd_intr, WAIT_WORSTCASE,
+                                       NULL);
+                       return ide_started;
+               }
                drive->io_32bit = 0;
                hwif->ata_input_data(drive, &args[4], args[3] * SECTOR_WORDS);
                drive->io_32bit = io_32bit;
@@ -653,7 +658,7 @@ static ide_startstop_t drive_cmd_intr (ide_drive_t *drive)
                local_irq_enable_in_hardirq();
                stat = hwif->INB(IDE_STATUS_REG);
        }
-out:
+
        if (!OK_STAT(stat, READY_STAT, BAD_STAT))
                return ide_error(drive, "drive_cmd", stat);
                /* calls ide_end_drive_cmd */