Skip to content

Commit dfc2f44

Browse files
authored
[SYCL] Fix for undefined Result on some code paths. (#4924)
Signed-off-by: Rajiv Deodhar <[email protected]>
1 parent 4f5fa0e commit dfc2f44

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

sycl/plugins/level_zero/pi_level_zero.cpp

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3161,18 +3161,17 @@ pi_result piMemBufferCreate(pi_context Context, pi_mem_flags Flags, size_t Size,
31613161
if (DeviceIsIntegrated) {
31623162
if (enableBufferPooling())
31633163
Result = piextUSMHostAlloc(&Ptr, Context, nullptr, Size, Alignment);
3164-
else {
3165-
ZeHostMemAllocHelper(&Ptr, Context, Size);
3166-
}
3164+
else
3165+
Result = ZeHostMemAllocHelper(&Ptr, Context, Size);
31673166
} else if (Context->SingleRootDevice) {
31683167
// If we have a single discrete device or all devices in the context are
31693168
// sub-devices of the same device then we can allocate on device
31703169
if (enableBufferPooling())
31713170
Result = piextUSMDeviceAlloc(&Ptr, Context, Context->SingleRootDevice,
31723171
nullptr, Size, Alignment);
3173-
else {
3174-
ZeDeviceMemAllocHelper(&Ptr, Context, Context->SingleRootDevice, Size);
3175-
}
3172+
else
3173+
Result = ZeDeviceMemAllocHelper(&Ptr, Context, Context->SingleRootDevice,
3174+
Size);
31763175
} else {
31773176
// Context with several gpu cards. Temporarily use host allocation because
31783177
// it is accessible by all devices. But it is not good in terms of
@@ -3182,9 +3181,8 @@ pi_result piMemBufferCreate(pi_context Context, pi_mem_flags Flags, size_t Size,
31823181
// resources as backing buffers to allow those transfers.
31833182
if (enableBufferPooling())
31843183
Result = piextUSMHostAlloc(&Ptr, Context, nullptr, Size, Alignment);
3185-
else {
3186-
ZeHostMemAllocHelper(&Ptr, Context, Size);
3187-
}
3184+
else
3185+
Result = ZeHostMemAllocHelper(&Ptr, Context, Size);
31883186
}
31893187

31903188
if (enableBufferPooling() && Result != PI_SUCCESS)

0 commit comments

Comments
 (0)