Skip to content

Commit a8227de

Browse files
committed
ARMCC: invalidate mutex->id when RTOS is not initialized
1 parent 86f8687 commit a8227de

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

source/armcc/retarget_os_rtos2.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,15 @@ struct rt_mutex_s {
6161
__USED int _mutex_initialize(rt_mutex_t *mutex) {
6262
int result = 0;
6363

64-
if (os_kernel_is_initialized()) {
65-
mutex->id = osMutexNew(NULL);
64+
if (mutex != NULL) {
65+
mutex->id = NULL;
6666

67-
if (mutex->id != NULL) {
68-
result = 1;
67+
if (os_kernel_is_initialized()) {
68+
mutex->id = osMutexNew(NULL);
69+
70+
if (mutex->id != NULL) {
71+
result = 1;
72+
}
6973
}
7074
}
7175
return result;

0 commit comments

Comments
 (0)