kernel: mem_domain: init function to return error values

This changes k_mem_domain_init() to return error values
instead of asserting when errors are encountered.
This gives applications a chance to recover if needed.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
This commit is contained in:
Daniel Leung 2021-11-11 12:49:58 -08:00 committed by Anas Nashif
commit fb91ce2e21
13 changed files with 122 additions and 53 deletions

View file

@ -121,9 +121,13 @@ struct k_mem_partition;
* @param num_parts The number of array items of "parts" parameter.
* @param parts An array of pointers to the memory partitions. Can be NULL
* if num_parts is zero.
*
* @retval 0 if successful
* @retval -EINVAL if invalid parameters supplied
* @retval -ENOMEM if insufficient memory
*/
extern void k_mem_domain_init(struct k_mem_domain *domain, uint8_t num_parts,
struct k_mem_partition *parts[]);
extern int k_mem_domain_init(struct k_mem_domain *domain, uint8_t num_parts,
struct k_mem_partition *parts[]);
/**
* @brief Add a memory partition into a memory domain.