Skip to content

Commit 1e152ff

Browse files
Niranjhana Nnashif
authored andcommitted
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 <[email protected]>
1 parent 9da6a85 commit 1e152ff

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/cmsis_rtos_v1/cmsis_thread.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,13 @@ osThreadId osThreadCreate(const osThreadDef_t *thread_def, void *arg)
4545
k_thread_stack_t
4646
(*stk_ptr)[K_THREAD_STACK_LEN(CONFIG_CMSIS_THREAD_MAX_STACK_SIZE)];
4747

48-
__ASSERT(thread_def->stacksize <= CONFIG_CMSIS_THREAD_MAX_STACK_SIZE,
49-
"invalid stack size\n");
50-
5148
if ((thread_def == NULL) || (thread_def->instances == 0)) {
5249
return NULL;
5350
}
5451

52+
__ASSERT(thread_def->stacksize <= CONFIG_CMSIS_THREAD_MAX_STACK_SIZE,
53+
"invalid stack size\n");
54+
5555
if (_is_in_isr()) {
5656
return NULL;
5757
}

0 commit comments

Comments
 (0)