Skip to content

Commit 5baf591

Browse files
Follow DPCTLDevice_CreateFromSelector which passes the check
1 parent 0951961 commit 5baf591

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

dpctl-capi/source/dpctl_sycl_platform_interface.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -76,13 +76,12 @@ __dpctl_give DPCTLSyclPlatformRef DPCTLPlatform_Create()
7676
__dpctl_give DPCTLSyclPlatformRef DPCTLPlatform_CreateFromSelector(
7777
__dpctl_keep const DPCTLSyclDeviceSelectorRef DSRef)
7878
{
79-
DPCTLSyclPlatformRef PRef = nullptr;
80-
auto DS = unwrap(DSRef);
81-
if (DS) {
79+
if (DSRef) {
80+
auto DS = unwrap(DSRef);
8281
platform *P = nullptr;
8382
try {
8483
P = new platform(*DS);
85-
PRef = wrap(P);
84+
return wrap(P);
8685
} catch (std::bad_alloc const &ba) {
8786
std::cerr << ba.what() << '\n';
8887
return nullptr;
@@ -96,7 +95,7 @@ __dpctl_give DPCTLSyclPlatformRef DPCTLPlatform_CreateFromSelector(
9695
std::cerr << "Device selector pointer cannot be NULL\n";
9796
}
9897

99-
return PRef;
98+
return nullptr;
10099
}
101100

102101
void DPCTLPlatform_Delete(__dpctl_take DPCTLSyclPlatformRef PRef)

0 commit comments

Comments
 (0)