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:
parent
9da6a85c8c
commit
1e152ff20e
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue