From 9323901253f0488afe5762eed1e48ebeae9679ce Mon Sep 17 00:00:00 2001 From: Michael Lotz Date: Sat, 18 Apr 2009 21:32:00 +0000 Subject: [PATCH] Check the result after sending the packet, other error conditions like media presence will be triggered there and we use FinishRequest() to catch those. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30250 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../kernel/bus_managers/ata/ATAPIDevice.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/add-ons/kernel/bus_managers/ata/ATAPIDevice.cpp b/src/add-ons/kernel/bus_managers/ata/ATAPIDevice.cpp index 3869672656..cbf5ddde16 100644 --- a/src/add-ons/kernel/bus_managers/ata/ATAPIDevice.cpp +++ b/src/add-ons/kernel/bus_managers/ata/ATAPIDevice.cpp @@ -140,12 +140,16 @@ ATAPIDevice::SendPacket(ATARequest *request) return B_ERROR; } - if (fChannel->Wait(ATA_STATUS_DATA_REQUEST, ATA_STATUS_BUSY, - ATA_CHECK_ERROR_BIT | ATA_CHECK_DEVICE_FAULT, - request->Timeout()) != B_OK) { - TRACE_ERROR("timeout waiting for device to request data\n"); - request->SetStatus(SCSI_CMD_TIMEOUT); - return B_TIMED_OUT; + result = fChannel->Wait(ATA_STATUS_DATA_REQUEST, ATA_STATUS_BUSY, + ATA_CHECK_ERROR_BIT | ATA_CHECK_DEVICE_FAULT, request->Timeout()); + if (result != B_OK) { + if (result == B_TIMED_OUT) { + TRACE_ERROR("timeout waiting for device to request data\n"); + request->SetStatus(SCSI_CMD_TIMEOUT); + return B_TIMED_OUT; + } else + return fChannel->FinishRequest(request, ATA_WAIT_FINISH + | ATA_CHECK_DEVICE_FAULT, ATA_ERROR_ALL); } // PIO data transfer