Skip to content

Commit 40100a9

Browse files
author
Alexander Batashev
authored
[SYCL] Fix warnings from static analysis tool (#2193)
Signed-off-by: Alexander Batashev <[email protected]>
1 parent 226bc2a commit 40100a9

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

sycl/plugins/level_zero/pi_level0.cpp

+8
Original file line numberDiff line numberDiff line change
@@ -2258,6 +2258,8 @@ piEnqueueKernelLaunch(pi_queue Queue, pi_kernel Kernel, pi_uint32 WorkDim,
22582258

22592259
ze_event_handle_t *ZeEventWaitList =
22602260
_pi_event::createZeEventList(NumEventsInWaitList, EventWaitList);
2261+
if (!ZeEventWaitList)
2262+
return PI_OUT_OF_HOST_MEMORY;
22612263

22622264
// Add the command to the command list
22632265
ZE_CALL(zeCommandListAppendLaunchKernel(
@@ -2708,6 +2710,8 @@ enqueueMemCopyHelper(pi_command_type CommandType, pi_queue Queue, void *Dst,
27082710

27092711
ze_event_handle_t *ZeEventWaitList =
27102712
_pi_event::createZeEventList(NumEventsInWaitList, EventWaitList);
2713+
if (!ZeEventWaitList)
2714+
return PI_OUT_OF_HOST_MEMORY;
27112715

27122716
ZE_CALL(zeCommandListAppendWaitOnEvents(ZeCommandList, NumEventsInWaitList,
27132717
ZeEventWaitList));
@@ -2766,6 +2770,8 @@ static pi_result enqueueMemCopyRectHelper(
27662770

27672771
ze_event_handle_t *ZeEventWaitList =
27682772
_pi_event::createZeEventList(NumEventsInWaitList, EventWaitList);
2773+
if (!ZeEventWaitList)
2774+
return PI_OUT_OF_HOST_MEMORY;
27692775

27702776
ZE_CALL(zeCommandListAppendWaitOnEvents(ZeCommandList, NumEventsInWaitList,
27712777
ZeEventWaitList));
@@ -2926,6 +2932,8 @@ enqueueMemFillHelper(pi_command_type CommandType, pi_queue Queue, void *Ptr,
29262932

29272933
ze_event_handle_t *ZeEventWaitList =
29282934
_pi_event::createZeEventList(NumEventsInWaitList, EventWaitList);
2935+
if (!ZeEventWaitList)
2936+
return PI_OUT_OF_HOST_MEMORY;
29292937

29302938
ZE_CALL(zeCommandListAppendWaitOnEvents(ZeCommandList, NumEventsInWaitList,
29312939
ZeEventWaitList));

sycl/source/detail/program_impl.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,7 @@ bool program_impl::has_cl_kernel(const string_class &KernelName) const {
399399
}
400400

401401
RT::PiKernel program_impl::get_pi_kernel(const string_class &KernelName) const {
402-
RT::PiKernel Kernel;
402+
RT::PiKernel Kernel = nullptr;
403403

404404
if (is_cacheable()) {
405405
std::tie(Kernel, std::ignore) =

sycl/source/detail/scheduler/graph_builder.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ Scheduler::GraphBuilder::GraphBuilder() {
9393
}
9494

9595
static bool markNodeAsVisited(Command *Cmd, std::vector<Command *> &Visited) {
96+
assert(Cmd && "Cmd can't be nullptr");
9697
if (Cmd->MMarks.MVisited)
9798
return false;
9899
Cmd->MMarks.MVisited = true;

0 commit comments

Comments
 (0)