ide: unify exit paths in task_pio_intr()

There should be no functional changes caused by this patch.
Signed-off-by: default avatarBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
parent 151055ed
...@@ -326,35 +326,28 @@ static ide_startstop_t task_pio_intr(ide_drive_t *drive) ...@@ -326,35 +326,28 @@ static ide_startstop_t task_pio_intr(ide_drive_t *drive)
if (write == 0) { if (write == 0) {
/* Error? */ /* Error? */
if (stat & ATA_ERR) if (stat & ATA_ERR)
return task_error(drive, cmd, __func__, stat); goto out_err;
/* Didn't want any data? Odd. */ /* Didn't want any data? Odd. */
if ((stat & ATA_DRQ) == 0) { if ((stat & ATA_DRQ) == 0) {
/* Command all done? */ /* Command all done? */
if (OK_STAT(stat, ATA_DRDY, ATA_BUSY)) { if (OK_STAT(stat, ATA_DRDY, ATA_BUSY))
ide_finish_cmd(drive, cmd, stat); goto out_end;
return ide_stopped;
}
/* Assume it was a spurious irq */ /* Assume it was a spurious irq */
ide_set_handler(drive, &task_pio_intr, WAIT_WORSTCASE, goto out_wait;
NULL);
return ide_started;
} }
} else { } else {
if (!OK_STAT(stat, DRIVE_READY, drive->bad_wstat)) if (!OK_STAT(stat, DRIVE_READY, drive->bad_wstat))
return task_error(drive, cmd, __func__, stat); goto out_err;
/* Deal with unexpected ATA data phase. */ /* Deal with unexpected ATA data phase. */
if (((stat & ATA_DRQ) == 0) ^ (cmd->nleft == 0)) if (((stat & ATA_DRQ) == 0) ^ (cmd->nleft == 0))
return task_error(drive, cmd, __func__, stat); goto out_err;
} }
if (write && cmd->nleft == 0) { if (write && cmd->nleft == 0)
ide_finish_cmd(drive, cmd, stat); goto out_end;
return ide_stopped;
}
/* Still data left to transfer. */ /* Still data left to transfer. */
ide_pio_datablock(drive, cmd, write); ide_pio_datablock(drive, cmd, write);
...@@ -363,15 +356,19 @@ static ide_startstop_t task_pio_intr(ide_drive_t *drive) ...@@ -363,15 +356,19 @@ static ide_startstop_t task_pio_intr(ide_drive_t *drive)
if (write == 0 && cmd->nleft == 0) { if (write == 0 && cmd->nleft == 0) {
stat = wait_drive_not_busy(drive); stat = wait_drive_not_busy(drive);
if (!OK_STAT(stat, 0, BAD_STAT)) if (!OK_STAT(stat, 0, BAD_STAT))
return task_error(drive, cmd, __func__, stat); goto out_err;
ide_finish_cmd(drive, cmd, stat);
return ide_stopped;
}
goto out_end;
}
out_wait:
/* Still data left to transfer. */ /* Still data left to transfer. */
ide_set_handler(drive, &task_pio_intr, WAIT_WORSTCASE, NULL); ide_set_handler(drive, &task_pio_intr, WAIT_WORSTCASE, NULL);
return ide_started; return ide_started;
out_end:
ide_finish_cmd(drive, cmd, stat);
return ide_stopped;
out_err:
return task_error(drive, cmd, __func__, stat);
} }
static ide_startstop_t pre_task_out_intr(ide_drive_t *drive, static ide_startstop_t pre_task_out_intr(ide_drive_t *drive,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment