Skip to content

Commit

Permalink
[Media Common][VP] clean coverity isuues mos
Browse files Browse the repository at this point in the history
clean mos coverity issues
  • Loading branch information
jiafengy1 authored and intel-mediadev committed Sep 5, 2023
1 parent bf72cea commit 7a5cb2b
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 7 deletions.
1 change: 1 addition & 0 deletions media_driver/agnostic/common/os/mos_graphicsresource.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ MOS_STATUS GraphicsResource::Dump(OsContext* osContextPtr, uint32_t overrideOffs
if (hFile != nullptr)
{
MosUtilities::MosCloseHandle(hFile);
hFile = nullptr;
}
}

Expand Down
2 changes: 1 addition & 1 deletion media_driver/agnostic/common/os/mos_os_virtualengine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ MOS_STATUS Mos_VirtualEngineInterface_Initialize(
pVEInterf->veInterface = MOS_New(MosOsVeSinglePipeSpecific);
}
MOS_OS_CHK_NULL(pVEInterf->veInterface);
pVEInterf->veInterface->Initialize(pOsInterface->osStreamState, pVEInitParms);
MOS_OS_CHK_STATUS(pVEInterf->veInterface->Initialize(pOsInterface->osStreamState, pVEInitParms));
pOsInterface->osStreamState->virtualEngineInterface = pVEInterf->veInterface;
}
return eStatus;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,8 @@ class RenderpassData
// free all allocated surfaces
while (i > 0)
{
MOS_FreeMemAndSetNull(TempOutputSurfaces[--i]);
--i;
MOS_FreeMemAndSetNull(TempOutputSurfaces[i]);
}
return MOS_STATUS_NO_SPACE;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -240,15 +240,25 @@ MOS_STATUS MemoryBlockManager::RegisterHeap(uint32_t heapId, uint32_t size , boo

auto heap = MOS_New(Heap, heapId);
HEAP_CHK_NULL(heap);
HEAP_CHK_STATUS(heap->RegisterOsInterface(m_osInterface));
eStatus = heap->RegisterOsInterface(m_osInterface);
if (MOS_FAILED(eStatus))
{
MOS_Delete(heap);
HEAP_CHK_STATUS(eStatus);
}
size = MOS_ALIGN_CEIL(size, m_heapAlignment);

if (hwWriteOnly)
{
heap->SetHeapHwWriteOnly(hwWriteOnly);
}

HEAP_CHK_STATUS(heap->Allocate(size, m_lockHeapsOnAllocate));
eStatus = heap->Allocate(size, m_lockHeapsOnAllocate);
if (MOS_FAILED(eStatus))
{
MOS_Delete(heap);
HEAP_CHK_STATUS(eStatus);
}

if (heap->IsValid())
{
Expand All @@ -264,7 +274,12 @@ MOS_STATUS MemoryBlockManager::RegisterHeap(uint32_t heapId, uint32_t size , boo

std::shared_ptr<HeapWithAdjacencyBlockList> managedHeap = nullptr;
managedHeap = MakeShared<HeapWithAdjacencyBlockList>();
HEAP_CHK_NULL(managedHeap);
if (managedHeap == nullptr)
{
MOS_Delete(heap);
MOS_Delete(adjacencyListBegin);
HEAP_CHK_STATUS(MOS_STATUS_NULL_POINTER);
}
managedHeap->m_heap = heap;
managedHeap->m_size = managedHeap->m_heap->GetSize();
managedHeap->m_adjacencyListBegin = adjacencyListBegin;
Expand Down Expand Up @@ -298,7 +313,7 @@ MOS_STATUS MemoryBlockManager::UnregisterHeap(uint32_t heapId)
if (heapId == (*iterator)->m_heap->GetId())
{
bool blocksUpdated = false;
RefreshBlockStates(blocksUpdated);
HEAP_CHK_STATUS(RefreshBlockStates(blocksUpdated));
(*iterator)->m_heap->PrepareForFree();
m_totalSizeOfHeaps -= (*iterator)->m_heap->GetSize();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -732,7 +732,7 @@ MOS_STATUS SwFilterPipe::AddSwFilterUnordered(SwFilter *swFilter, bool isInputPi

if (nullptr == pSubPipe && !isInputPipe)
{
auto& pipes = isInputPipe ? m_InputPipes : m_OutputPipes;
auto& pipes = m_OutputPipes;
SwFilterSubPipe *pipe = MOS_New(SwFilterSubPipe);
VP_PUBLIC_CHK_NULL_RETURN(pipe);
if ((size_t)index <= pipes.size())
Expand Down

0 comments on commit 7a5cb2b

Please sign in to comment.