From ad0b9c80f21f02bcb86704557c151fc355e9261e Mon Sep 17 00:00:00 2001 From: "Arya.Rafii" Date: Wed, 17 Feb 2021 14:08:14 -0500 Subject: [PATCH] SWDEV-269246 - Fixed null-case logic for hipCtxPopCurrent Change-Id: Ic173980caccde8afee85a75c55a5d536f421549e [ROCm/hip commit: 76abab2f24e0e8c64c872ef648d9353a77658f9b] --- projects/hip/rocclr/hip_context.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/projects/hip/rocclr/hip_context.cpp b/projects/hip/rocclr/hip_context.cpp index 69fa7e7bbc..09443d1c61 100755 --- a/projects/hip/rocclr/hip_context.cpp +++ b/projects/hip/rocclr/hip_context.cpp @@ -214,12 +214,10 @@ hipError_t hipCtxPopCurrent(hipCtx_t* ctx) { HIP_INIT_API(hipCtxPopCurrent, ctx); hip::Device** dev = reinterpret_cast(ctx); - if (dev == nullptr) { - HIP_RETURN(hipErrorInvalidContext); - } - if (!g_ctxtStack.empty()) { - *dev = g_ctxtStack.top(); + if (dev != nullptr) { + *dev = g_ctxtStack.top(); + } g_ctxtStack.pop(); } else { DevLogError("Context Stack empty \n");