diff --git a/runtime/api/api.cpp b/runtime/api/api.cpp index b3a706db8c..ca6cd803fd 100644 --- a/runtime/api/api.cpp +++ b/runtime/api/api.cpp @@ -4238,20 +4238,16 @@ cl_int CL_API_CALL clAddCommentINTEL(cl_platform_id platform, const char *commen API_ENTER(&retVal); DBG_LOG_INPUTS("platform", platform, "comment", comment); - Platform *pPlatform = nullptr; - retVal = validateObjects(WithCastToInternal(platform, &pPlatform)); + auto executionEnvironment = ::platform()->peekExecutionEnvironment(); + auto aubCenter = executionEnvironment->aubCenter.get(); - if (retVal == CL_SUCCESS) { - auto executionEnvironment = pPlatform->peekExecutionEnvironment(); - auto aubCenter = executionEnvironment->aubCenter.get(); - - if (!comment || (aubCenter && !aubCenter->getAubManager())) { - retVal = CL_INVALID_VALUE; - } - - if (retVal == CL_SUCCESS && aubCenter) { - aubCenter->getAubManager()->addComment(comment); - } + if (!comment || (aubCenter && !aubCenter->getAubManager())) { + retVal = CL_INVALID_VALUE; } + + if (retVal == CL_SUCCESS && aubCenter) { + aubCenter->getAubManager()->addComment(comment); + } + return retVal; } diff --git a/unit_tests/api/cl_add_comment_to_aub_tests.inl b/unit_tests/api/cl_add_comment_to_aub_tests.inl index cd8669e45c..989521192e 100644 --- a/unit_tests/api/cl_add_comment_to_aub_tests.inl +++ b/unit_tests/api/cl_add_comment_to_aub_tests.inl @@ -17,11 +17,6 @@ namespace ULT { using clAddCommentToAubTest = api_tests; -TEST(clAddCommentToAub, givenInvalidPlatformWhenAddCommentToAubThenErrorIsReturned) { - auto retVal = clAddCommentINTEL(nullptr, "comment"); - EXPECT_EQ(CL_INVALID_PLATFORM, retVal); -} - TEST_F(clAddCommentToAubTest, givenProperCommentNullptrAubCenterWhenAddCommentToAubThenSuccessIsReturned) { auto retVal = clAddCommentINTEL(pPlatform, "comment"); EXPECT_EQ(CL_SUCCESS, retVal);