kernel: mem_domain: add/remove partition funcs to return errors

This changes both k_mem_domain_add_partition() and
k_mem_domain_remove_partition() to return errors instead of
asserting when errors are encountered. This gives the application
chance to recover.

The arch_mem_domain_parition_add()/_remove() will be modified
later together with all the other arch_mem_domain_*() changes
since the architecture code for partition addition and removal
functions usually cannot be separately changed.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
This commit is contained in:
Daniel Leung 2021-11-10 11:11:00 -08:00 committed by Anas Nashif
commit bb595a85f1
9 changed files with 210 additions and 81 deletions

View file

@ -151,8 +151,12 @@ extern int k_mem_domain_init(struct k_mem_domain *domain, uint8_t num_parts,
*
* @param domain The memory domain to be added a memory partition.
* @param part The memory partition to be added
*
* @retval 0 if successful
* @retval -EINVAL if invalid parameters supplied
* @retval -ENOSPC if no free partition slots available
*/
extern void k_mem_domain_add_partition(struct k_mem_domain *domain,
extern int k_mem_domain_add_partition(struct k_mem_domain *domain,
struct k_mem_partition *part);
/**
@ -162,8 +166,12 @@ extern void k_mem_domain_add_partition(struct k_mem_domain *domain,
*
* @param domain The memory domain to be removed a memory partition.
* @param part The memory partition to be removed
*
* @retval 0 if successful
* @retval -EINVAL if invalid parameters supplied
* @retval -ENOENT if no matching partition found
*/
extern void k_mem_domain_remove_partition(struct k_mem_domain *domain,
extern int k_mem_domain_remove_partition(struct k_mem_domain *domain,
struct k_mem_partition *part);
/**