diff --git a/projects/clr/hipamd/src/hip_texture.cpp b/projects/clr/hipamd/src/hip_texture.cpp index 57ecfe3848..21cccda234 100644 --- a/projects/clr/hipamd/src/hip_texture.cpp +++ b/projects/clr/hipamd/src/hip_texture.cpp @@ -633,12 +633,6 @@ hipError_t hipBindTexture2D(size_t* offset, hipError_t ihipBindTextureToArray(const textureReference* texref, hipArray_const_t array, const hipChannelFormatDesc* desc) { - if ((texref == nullptr) || - (array == nullptr) || - (desc == nullptr)) { - return hipErrorInvalidValue; - } - // Any previous address or HIP array state associated with the texture reference is superseded by this function. // Any memory previously bound to hTexRef is unbound. // No need to check for errors. @@ -664,6 +658,10 @@ hipError_t hipBindTextureToArray(const textureReference* texref, const hipChannelFormatDesc* desc) { HIP_INIT_API(hipBindTextureToArray, texref, array, desc); + if ((texref == nullptr) || (array == nullptr) || (desc == nullptr)) { + return hipErrorInvalidValue; + } + hipDeviceptr_t refDevPtr = nullptr; size_t refDevSize = 0; HIP_RETURN_ONFAIL(PlatformState::instance().getStatGlobalVar(texref, ihipGetDevice(), &refDevPtr,