From abe0c14301f6f95df6a2563d66674aadd4fc456f Mon Sep 17 00:00:00 2001 From: joevt Date: Sat, 4 Nov 2023 22:19:39 -0700 Subject: [PATCH] scsibus: push_data of zero bytes is ok. It just means the data hasn't been put on the fifo yet. --- devices/common/scsi/scsibus.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/devices/common/scsi/scsibus.cpp b/devices/common/scsi/scsibus.cpp index 6f4d3b3..75de5cd 100644 --- a/devices/common/scsi/scsibus.cpp +++ b/devices/common/scsi/scsibus.cpp @@ -263,11 +263,18 @@ bool ScsiBus::pull_data(const int id, uint8_t* dst_ptr, const int size) bool ScsiBus::push_data(const int id, const uint8_t* src_ptr, const int size) { - if (!this->devices[id]->rcv_data(src_ptr, size)) { - LOG_F(ERROR, "ScsiBus: error while transferring I->T data!"); + if (!this->devices[id]) { + LOG_F(ERROR, "%s: no device %d for push_data %d bytes", this->get_name().c_str(), id, size); return false; } + if (!this->devices[id]->rcv_data(src_ptr, size)) { + if (size) { + LOG_F(ERROR, "%s: error while transferring I->T data!", this->get_name().c_str()); + return false; + } + } + return true; }