[Offload] Fix Error checking (#141939)

All errors must be checked - this includes the local variable we were
using to increase the lifetime of `Res`. As we were not explicitly
checking it, it resulted in an `abort` in debug builds.
This commit is contained in:
Ross Brunton
2025-05-29 14:17:08 +01:00
committed by GitHub
parent ee91f9b4a2
commit 7efb79b705

View File

@@ -416,18 +416,20 @@ Error olMemcpy_impl(ol_queue_handle_t Queue, void *DstPtr,
// If no queue is given the memcpy will be synchronous // If no queue is given the memcpy will be synchronous
auto QueueImpl = Queue ? Queue->AsyncInfo : nullptr; auto QueueImpl = Queue ? Queue->AsyncInfo : nullptr;
Error Res = Error::success();
if (DstDevice == HostDevice()) { if (DstDevice == HostDevice()) {
Res = SrcDevice->Device->dataRetrieve(DstPtr, SrcPtr, Size, QueueImpl); if (auto Res =
SrcDevice->Device->dataRetrieve(DstPtr, SrcPtr, Size, QueueImpl))
return Res;
} else if (SrcDevice == HostDevice()) { } else if (SrcDevice == HostDevice()) {
Res = DstDevice->Device->dataSubmit(DstPtr, SrcPtr, Size, QueueImpl); if (auto Res =
DstDevice->Device->dataSubmit(DstPtr, SrcPtr, Size, QueueImpl))
return Res;
} else { } else {
Res = SrcDevice->Device->dataExchange(SrcPtr, *DstDevice->Device, DstPtr, if (auto Res = SrcDevice->Device->dataExchange(SrcPtr, *DstDevice->Device,
Size, QueueImpl); DstPtr, Size, QueueImpl))
return Res;
} }
if (Res)
return Res;
if (EventOut) if (EventOut)
*EventOut = makeEvent(Queue); *EventOut = makeEvent(Queue);