Skip to content

Commit

Permalink
[VP] Fix coverity issue for heap manager
Browse files Browse the repository at this point in the history
Fix coverity issue for heap manager: logically dead code
  • Loading branch information
kchen1024 authored and intel-mediadev committed Jul 18, 2024
1 parent 76260ff commit 6f2977f
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 6 deletions.
21 changes: 19 additions & 2 deletions media_softlet/agnostic/common/renderhal/renderhal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1430,8 +1430,25 @@ MOS_STATUS RenderHal_AllocateStateHeaps(
if (!pStateHeap->surfaceStateMgr)
{
pStateHeap->surfaceStateMgr = MOS_New(SurfaceStateHeapManager, pRenderHal->pOsInterface);
MHW_RENDERHAL_CHK_NULL_RETURN(pStateHeap->surfaceStateMgr);
MHW_RENDERHAL_CHK_STATUS_RETURN(pStateHeap->surfaceStateMgr->CreateHeap(pRenderHal->pRenderHalPltInterface->GetSurfaceStateCmdSize()));
if (pStateHeap->surfaceStateMgr == nullptr)
{
MHW_RENDERHAL_ASSERTMESSAGE("Fail to Allocate SSH manager.");
// Free State Heap control structure
MOS_AlignedFreeMemory(pStateHeap);
pRenderHal->pStateHeap = nullptr;
return MOS_STATUS_NULL_POINTER;
}

eStatus = pStateHeap->surfaceStateMgr->CreateHeap(pRenderHal->pRenderHalPltInterface->GetSurfaceStateCmdSize());
if (eStatus != MOS_STATUS_SUCCESS)
{
MHW_RENDERHAL_ASSERTMESSAGE("Fail to Allocate SSH manager.");
MHW_RENDERHAL_CHK_STATUS_RETURN(pStateHeap->surfaceStateMgr->DestroyHeap());
// Free State Heap control structure
MOS_AlignedFreeMemory(pStateHeap);
pRenderHal->pStateHeap = nullptr;
return eStatus;
}
pStateHeap->iCurrentSurfaceState = pStateHeap->surfaceStateMgr->m_surfStateHeap->uiCurState;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,6 @@ MOS_STATUS SurfaceStateHeapManager::CreateHeap(size_t surfStateSize)
(uint32_t *)(m_surfStateHeap->pLockedOsResourceMem +
m_surfStateHeap->uiOffsetSync);

if (eStatus != MOS_STATUS_SUCCESS)
{
DestroyHeap();
}
return eStatus;
}

Expand Down

0 comments on commit 6f2977f

Please sign in to comment.