Skip to content

Commit 17a1f88

Browse files
authored
Merge pull request #186 from vlad-perevezentsev/fix_warnings
Fix problems in dpctl identified with Klockwork static code analysis
2 parents 072277e + 1d3e887 commit 17a1f88

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

backends/source/dppl_sycl_context_interface.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,11 @@ bool DPPLContext_AreEq (__dppl_keep const DPPLSyclContextRef CtxRef1,
4747

4848
bool DPPLContext_IsHost (__dppl_keep const DPPLSyclContextRef CtxRef)
4949
{
50-
return unwrap(CtxRef)->is_host();
50+
auto Ctx = unwrap(CtxRef);
51+
if (Ctx) {
52+
return Ctx->is_host();
53+
}
54+
return false;
5155
}
5256

5357
void DPPLContext_Delete (__dppl_take DPPLSyclContextRef CtxRef)

backends/source/dppl_sycl_platform_interface.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,12 @@ size_t DPPLPlatform_GetNumNonHostPlatforms ()
148148

149149
size_t DPPLPlatform_GetNumNonHostBackends ()
150150
{
151-
return get_set_of_non_hostbackends().size();
151+
auto be_set = get_set_of_non_hostbackends();
152+
153+
if (be_set.empty())
154+
return 0;
155+
156+
return be_set.size();
152157
}
153158

154159
__dppl_give DPPLSyclBackendType *DPPLPlatform_GetListOfNonHostBackends ()

0 commit comments

Comments
 (0)