Skip to content

Commit eb3e6ef

Browse files
Correct GetPlatformIDs error when platform fails to initialize
Change-Id: Icb25cd2924aa406c08af9d47a1002ba6d23724f7 Signed-off-by: Adam Cetnerowski <[email protected]>
1 parent 9e9e7ab commit eb3e6ef

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

runtime/api/api.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ cl_int CL_API_CALL clGetPlatformIDs(cl_uint numEntries,
7878
bool ret = pPlatform->initialize();
7979
DEBUG_BREAK_IF(ret != true);
8080
if (!ret) {
81-
retVal = CL_INVALID_VALUE;
81+
retVal = CL_OUT_OF_HOST_MEMORY;
8282
break;
8383
}
8484

unit_tests/api/cl_get_platform_ids_tests.inl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ TEST_F(clGetPlatformIDsTests, GivenNumEntriesZeroAndPlatformNotNullWhenGettingPl
4949
EXPECT_EQ(CL_INVALID_VALUE, retVal);
5050
}
5151

52-
TEST(clGetPlatformIDsNegativeTests, GivenFailedInitWhenGettingPlatformIdsThenClInvalidValueErrorIsReturned) {
52+
TEST(clGetPlatformIDsNegativeTests, GivenFailedInitializationWhenGettingPlatformIdsThenClOutOfHostMemoryErrorIsReturned) {
5353
VariableBackup<decltype(getDevicesResult)> bkp(&getDevicesResult, false);
5454

5555
cl_int retVal = CL_SUCCESS;
@@ -58,7 +58,7 @@ TEST(clGetPlatformIDsNegativeTests, GivenFailedInitWhenGettingPlatformIdsThenClI
5858

5959
retVal = clGetPlatformIDs(1, &platformRet, &numPlatforms);
6060

61-
EXPECT_EQ(CL_INVALID_VALUE, retVal);
61+
EXPECT_EQ(CL_OUT_OF_HOST_MEMORY, retVal);
6262
EXPECT_EQ(0u, numPlatforms);
6363
EXPECT_EQ(nullptr, platformRet);
6464

0 commit comments

Comments
 (0)