diff --git a/sys/dev/ata/ata-queue.c b/sys/dev/ata/ata-queue.c index f3bdfa33dee8..03e38279ec1f 100644 --- a/sys/dev/ata/ata-queue.c +++ b/sys/dev/ata/ata-queue.c @@ -238,14 +238,11 @@ ata_completed(void *context, int dummy) /* if we had a timeout, reinit channel and deal with the falldown */ if (request->flags & ATA_R_TIMEOUT) { - int error = ata_reinit(ch); - - /* if our device disappeared return as cleanup was done already */ - if (!request->device->param) - return; - - /* if reinit succeeded and retries still permit, reinject request */ - if (!error && request->retries-- > 0) { + /* + * if reinit succeeds, retries still permit and device didn't + * get removed by the reinit, reinject request + */ + if (ata_reinit(ch) && request->retries-- > 0 && request->device->param){ request->flags &= ~(ATA_R_TIMEOUT | ATA_R_DEBUG); request->flags |= (ATA_R_IMMEDIATE | ATA_R_REQUEUE); ATA_DEBUG_RQ(request, "completed reinject");