590.44.01

This commit is contained in:
Maneet Singh
2025-12-02 15:32:25 -08:00
parent 2af9f1f0f7
commit a5bfb10e75
954 changed files with 421883 additions and 408177 deletions

View File

@@ -122,10 +122,19 @@ NV_STATUS __nvoc_objCreate_Object(Object **ppThis, Dynamic *pParent, NvU32 creat
Object *pParentObj = NULL;
Object *pThis;
// Assign `pThis`, allocating memory unless suppressed by flag.
status = __nvoc_handleObjCreateMemAlloc(createFlags, sizeof(Object), (void**)&pThis, (void**)ppThis);
if (status != NV_OK)
return status;
// Don't allocate memory if the caller has already done so.
if (createFlags & NVOC_OBJ_CREATE_FLAGS_IN_PLACE_CONSTRUCT)
{
NV_CHECK_OR_RETURN(LEVEL_ERROR, ppThis != NULL && *ppThis != NULL, NV_ERR_INVALID_PARAMETER);
pThis = *ppThis;
}
// Allocate memory
else
{
pThis = portMemAllocNonPaged(sizeof(Object));
NV_CHECK_OR_RETURN(LEVEL_ERROR, pThis != NULL, NV_ERR_NO_MEMORY);
}
// Zero is the initial value for everything.
portMemSet(pThis, 0, sizeof(Object));
@@ -143,6 +152,7 @@ NV_STATUS __nvoc_objCreate_Object(Object **ppThis, Dynamic *pParent, NvU32 creat
pThis->pParent = NULL;
}
// Initialize vtable, RTTI, etc., then call constructor.
__nvoc_init__Object(pThis);
status = __nvoc_ctor_Object(pThis);
if (status != NV_OK) goto __nvoc_objCreate_Object_cleanup;
@@ -150,24 +160,28 @@ NV_STATUS __nvoc_objCreate_Object(Object **ppThis, Dynamic *pParent, NvU32 creat
// Assignment has no effect if NVOC_OBJ_CREATE_FLAGS_IN_PLACE_CONSTRUCT is set.
*ppThis = pThis;
// Success
return NV_OK;
// Do not call destructors here since the constructor already called them.
__nvoc_objCreate_Object_cleanup:
// Unlink the child from the parent if it was linked above.
if (pParentObj != NULL)
objRemoveChild(pParentObj, pThis);
// Do not call destructors here since the constructor already called them.
// Zero out memory that was allocated by caller.
if (createFlags & NVOC_OBJ_CREATE_FLAGS_IN_PLACE_CONSTRUCT)
portMemSet(pThis, 0, sizeof(Object));
// Free memory allocated by `__nvoc_handleObjCreateMemAlloc`.
else
{
portMemFree(pThis);
*ppThis = NULL;
}
// coverity[leaked_storage:FALSE]
// Failure
return status;
}