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:
Yan, Like
2018-03-12 16:07:53 +08:00
committed by Jack Ren
parent b0f8781500
commit 05b8f366f6
4 changed files with 42 additions and 18 deletions

View File

@@ -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;
}