kernel: semaphore: k_sem_init error checking

Check for errors at runtime and stop depending on ASSERTs.
This changes the API for
- k_sem_init

k_sem_init now returns -EINVAL on invalid data.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
This commit is contained in:
Anas Nashif 2019-05-04 10:36:14 -04:00
commit 928af3ce09
2 changed files with 17 additions and 8 deletions

View file

@ -3443,10 +3443,12 @@ struct k_sem {
* @param initial_count Initial semaphore count.
* @param limit Maximum permitted semaphore count.
*
* @return N/A
* @retval 0 Semaphore created successfully
* @retval -EINVAL Invalid values
*
* @req K-SEM-001
*/
__syscall void k_sem_init(struct k_sem *sem, unsigned int initial_count,
__syscall int k_sem_init(struct k_sem *sem, unsigned int initial_count,
unsigned int limit);
/**