[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:
@@ -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);
|
||||||
|
|||||||
Reference in New Issue
Block a user