mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-09-24 10:17:28 +00:00
Remove ASSERT in lib functions
Replace ASSERT in lib functions with error message print and return a value indicating error to allow the caller of lib functions to handle the error. Change-Id: If166484238dc0734041adfdbb19a5b374c044e33 Signed-off-by: Yan, Like <like.yan@intel.com>
This commit is contained in:
@@ -266,7 +266,8 @@ void *malloc(unsigned int num_bytes)
|
||||
}
|
||||
|
||||
/* Check if memory allocation is successful */
|
||||
ASSERT(memory != NULL, "");
|
||||
if (memory == NULL)
|
||||
pr_err("%s: failed to alloc 0x%x Bytes", __func__, num_bytes);
|
||||
|
||||
/* Return memory pointer to caller */
|
||||
return memory;
|
||||
@@ -280,7 +281,8 @@ void *alloc_pages(unsigned int page_num)
|
||||
memory = allocate_mem(&Paging_Memory_Pool, page_num * CPU_PAGE_SIZE);
|
||||
|
||||
/* Check if memory allocation is successful */
|
||||
ASSERT(memory != NULL, "");
|
||||
if (memory == NULL)
|
||||
pr_err("%s: failed to alloc %d pages", __func__, page_num);
|
||||
|
||||
return memory;
|
||||
}
|
||||
|
Reference in New Issue
Block a user