From efadc772dbd8bc3c9ab49f286c69070d681cb151 Mon Sep 17 00:00:00 2001 From: Jaydeep Patel Date: Wed, 10 Aug 2022 12:30:11 +0000 Subject: [PATCH] SWDEV-351033 - Change error code to hipErrorHostMemoryNotRegistered Change-Id: I930bb1e2787e284f335689d1900bdd08d328272e --- hipamd/src/hip_memory.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/hipamd/src/hip_memory.cpp b/hipamd/src/hip_memory.cpp index 8d6edae6e4..4b171e9aa9 100644 --- a/hipamd/src/hip_memory.cpp +++ b/hipamd/src/hip_memory.cpp @@ -1136,6 +1136,9 @@ hipError_t hipHostRegister(void* hostPtr, size_t sizeBytes, unsigned int flags) } hipError_t ihipHostUnregister(void* hostPtr) { + if (hostPtr == nullptr) { + return hipErrorInvalidValue; + } size_t offset = 0; amd::Memory* mem = getMemoryObject(hostPtr, offset); @@ -1163,7 +1166,7 @@ hipError_t ihipHostUnregister(void* hostPtr) { } LogPrintfError("Cannot unregister host_ptr: 0x%x \n", hostPtr); - return hipErrorInvalidValue; + return hipErrorHostMemoryNotRegistered; }