lib: cmsis_rtos_v1: do null check before use

Moving a thread_def null check to top before
using the structure's elements.

Signed-off-by: Niranjhana N <niranjhana.n@intel.com>
This commit is contained in:
Niranjhana N 2018-09-21 15:47:51 +05:30 committed by Anas Nashif
parent 9da6a85c8c
commit 1e152ff20e
1 changed files with 3 additions and 3 deletions

View File

@ -45,13 +45,13 @@ osThreadId osThreadCreate(const osThreadDef_t *thread_def, void *arg)
k_thread_stack_t
(*stk_ptr)[K_THREAD_STACK_LEN(CONFIG_CMSIS_THREAD_MAX_STACK_SIZE)];
__ASSERT(thread_def->stacksize <= CONFIG_CMSIS_THREAD_MAX_STACK_SIZE,
"invalid stack size\n");
if ((thread_def == NULL) || (thread_def->instances == 0)) {
return NULL;
}
__ASSERT(thread_def->stacksize <= CONFIG_CMSIS_THREAD_MAX_STACK_SIZE,
"invalid stack size\n");
if (_is_in_isr()) {
return NULL;
}