Bladeren bron

RTX5: improved MISRA compliance (unused function return values)

Robert Rostohar 8 jaren geleden
bovenliggende
commit
3437a4f5e3

+ 2 - 2
CMSIS/RTOS2/RTX/Source/rtx_evflags.c

@@ -422,9 +422,9 @@ osStatus_t svcRtxEventFlagsDelete (osEventFlagsId_t ef_id) {
   // Free object memory
   if (ef->flags & osRtxFlagSystemObject) {
     if (osRtxInfo.mpi.event_flags != NULL) {
-      osRtxMemoryPoolFree(osRtxInfo.mpi.event_flags, ef);
+      (void)osRtxMemoryPoolFree(osRtxInfo.mpi.event_flags, ef);
     } else {
-      osRtxMemoryFree(osRtxInfo.mem.common, ef);
+      (void)osRtxMemoryFree(osRtxInfo.mem.common, ef);
     }
   }
 

File diff suppressed because it is too large
+ 118 - 118
CMSIS/RTOS2/RTX/Source/rtx_evr.c


+ 9 - 9
CMSIS/RTOS2/RTX/Source/rtx_lib.c

@@ -527,7 +527,7 @@ const uint32_t os_cb_sections[] = {
 #ifndef __MICROLIB
 extern void _platform_post_stackheap_init (void);
 __WEAK void _platform_post_stackheap_init (void) {
-  osKernelInitialize();
+  (void)osKernelInitialize();
 }
 #endif
 
@@ -535,7 +535,7 @@ __WEAK void _platform_post_stackheap_init (void) {
 
 extern void software_init_hook (void);
 __WEAK void software_init_hook (void) {
-  osKernelInitialize();
+  (void)osKernelInitialize();
 }
 
 #endif
@@ -588,7 +588,7 @@ void *__user_perthread_libspace (void) {
       }
     }
     if (n == (uint32_t)OS_THREAD_LIBSPACE_NUM) {
-      osRtxErrorNotify(osRtxErrorClibSpace, id);
+      (void)osRtxErrorNotify(osRtxErrorClibSpace, id);
     }
   } else {
     n = OS_THREAD_LIBSPACE_NUM;
@@ -611,7 +611,7 @@ int _mutex_initialize(mutex *m) {
     result = 1;
   } else {
     result = 0;
-    osRtxErrorNotify(osRtxErrorClibMutex, m);
+    (void)osRtxErrorNotify(osRtxErrorClibMutex, m);
   }
   return result;
 }
@@ -620,8 +620,8 @@ int _mutex_initialize(mutex *m) {
 __USED
 void _mutex_acquire(mutex *m);
 void _mutex_acquire(mutex *m) {
-  if (os_kernel_is_active()) {
-    osMutexAcquire(*m, osWaitForever);
+  if (os_kernel_is_active() != 0U) {
+    (void)osMutexAcquire(*m, osWaitForever);
   }
 }
 
@@ -629,8 +629,8 @@ void _mutex_acquire(mutex *m) {
 __USED
 void _mutex_release(mutex *m);
 void _mutex_release(mutex *m) {
-  if (os_kernel_is_active()) {
-    osMutexRelease(*m);
+  if (os_kernel_is_active() != 0U) {
+    (void)osMutexRelease(*m);
   }
 }
 
@@ -638,7 +638,7 @@ void _mutex_release(mutex *m) {
 __USED
 void _mutex_free(mutex *m);
 void _mutex_free(mutex *m) {
-  osMutexDelete(*m);
+  (void)osMutexDelete(*m);
 }
 
 #endif

+ 6 - 6
CMSIS/RTOS2/RTX/Source/rtx_mempool.c

@@ -251,9 +251,9 @@ osMemoryPoolId_t svcRtxMemoryPoolNew (uint32_t block_count, uint32_t block_size,
     if (mp_mem == NULL) {
       if (flags & osRtxFlagSystemObject) {
         if (osRtxInfo.mpi.memory_pool != NULL) {
-          osRtxMemoryPoolFree(osRtxInfo.mpi.memory_pool, mp);
+          (void)osRtxMemoryPoolFree(osRtxInfo.mpi.memory_pool, mp);
         } else {
-          osRtxMemoryFree(osRtxInfo.mem.common, mp);
+          (void)osRtxMemoryFree(osRtxInfo.mem.common, mp);
         }
       }
       mp = NULL;
@@ -270,7 +270,7 @@ osMemoryPoolId_t svcRtxMemoryPoolNew (uint32_t block_count, uint32_t block_size,
     mp->flags       = flags;
     mp->name        = name;
     mp->thread_list = NULL;
-    osRtxMemoryPoolInit(&mp->mp_info, block_count, block_size, mp_mem);
+    (void)osRtxMemoryPoolInit(&mp->mp_info, block_count, block_size, mp_mem);
 
     // Register post ISR processing function
     osRtxInfo.post_process.memory_pool = osRtxMemoryPoolPostProcess;
@@ -506,15 +506,15 @@ osStatus_t svcRtxMemoryPoolDelete (osMemoryPoolId_t mp_id) {
 
   // Free data memory
   if (mp->flags & osRtxFlagSystemMemory) {
-    osRtxMemoryFree(osRtxInfo.mem.mp_data, mp->mp_info.block_base);
+    (void)osRtxMemoryFree(osRtxInfo.mem.mp_data, mp->mp_info.block_base);
   }
 
   // Free object memory
   if (mp->flags & osRtxFlagSystemObject) {
     if (osRtxInfo.mpi.memory_pool != NULL) {
-      osRtxMemoryPoolFree(osRtxInfo.mpi.memory_pool, mp);
+      (void)osRtxMemoryPoolFree(osRtxInfo.mpi.memory_pool, mp);
     } else {
-      osRtxMemoryFree(osRtxInfo.mem.common, mp);
+      (void)osRtxMemoryFree(osRtxInfo.mem.common, mp);
     }
   }
 

+ 11 - 11
CMSIS/RTOS2/RTX/Source/rtx_msgqueue.c

@@ -72,7 +72,7 @@ static void MessageQueuePut (os_message_queue_t *mq, os_message_t *msg) {
     __enable_irq();
   }
 #else
-  atomic_inc32(&mq->msg_count);
+  (void)atomic_inc32(&mq->msg_count);
 #endif
 }
 
@@ -172,7 +172,7 @@ void osRtxMessageQueuePostProcess (os_message_t *msg) {
     MessageQueueRemove(mq, msg);
     // Free memory
     msg->state = osRtxObjectInactive;
-    osRtxMemoryPoolFree(&mq->mp_info, msg);
+    (void)osRtxMemoryPoolFree(&mq->mp_info, msg);
     // Check if Thread is waiting to send a Message
     if ((mq->thread_list != NULL) && (mq->thread_list->state == osRtxThreadWaitingMessagePut)) {
       // Try to allocate memory
@@ -214,7 +214,7 @@ void osRtxMessageQueuePostProcess (os_message_t *msg) {
       EvrRtxMessageQueueRetrieved(mq, (void *)reg[2]);
       // Free memory
       msg->state = osRtxObjectInactive;
-      osRtxMemoryPoolFree(&mq->mp_info, msg);
+      (void)osRtxMemoryPoolFree(&mq->mp_info, msg);
     } else {
       EvrRtxMessageQueueInserted(mq, (void *)msg->prev);
       MessageQueuePut(mq, msg);
@@ -301,9 +301,9 @@ osMessageQueueId_t svcRtxMessageQueueNew (uint32_t msg_count, uint32_t msg_size,
     if (mq_mem == NULL) {
       if (flags & osRtxFlagSystemObject) {
         if (osRtxInfo.mpi.message_queue != NULL) {
-          osRtxMemoryPoolFree(osRtxInfo.mpi.message_queue, mq);
+          (void)osRtxMemoryPoolFree(osRtxInfo.mpi.message_queue, mq);
         } else {
-          osRtxMemoryFree(osRtxInfo.mem.common, mq);
+          (void)osRtxMemoryFree(osRtxInfo.mem.common, mq);
         }
       }
       mq = NULL;
@@ -324,7 +324,7 @@ osMessageQueueId_t svcRtxMessageQueueNew (uint32_t msg_count, uint32_t msg_size,
     mq->msg_count   = 0U;
     mq->msg_first   = NULL;
     mq->msg_last    = NULL;
-    osRtxMemoryPoolInit(&mq->mp_info, msg_count, block_size, mq_mem);
+    (void)osRtxMemoryPoolInit(&mq->mp_info, msg_count, block_size, mq_mem);
 
     // Register post ISR processing function
     osRtxInfo.post_process.message_queue = osRtxMessageQueuePostProcess;
@@ -466,7 +466,7 @@ osStatus_t svcRtxMessageQueueGet (osMessageQueueId_t mq_id, void *msg_ptr, uint8
     EvrRtxMessageQueueRetrieved(mq, msg_ptr);
     // Free memory
     msg->state = osRtxObjectInactive;
-    osRtxMemoryPoolFree(&mq->mp_info, msg);
+    (void)osRtxMemoryPoolFree(&mq->mp_info, msg);
     // Check if Thread is waiting to send a Message
     if ((mq->thread_list != NULL) && (mq->thread_list->state == osRtxThreadWaitingMessagePut)) {
       // Try to allocate memory
@@ -631,7 +631,7 @@ osStatus_t svcRtxMessageQueueReset (osMessageQueueId_t mq_id) {
     EvrRtxMessageQueueRetrieved(mq, NULL);
     // Free memory
     msg->state = osRtxObjectInactive;
-    osRtxMemoryPoolFree(&mq->mp_info, msg);
+    (void)osRtxMemoryPoolFree(&mq->mp_info, msg);
   }
 
   // Check if Threads are waiting to send Messages
@@ -695,15 +695,15 @@ osStatus_t svcRtxMessageQueueDelete (osMessageQueueId_t mq_id) {
 
   // Free data memory
   if (mq->flags & osRtxFlagSystemMemory) {
-    osRtxMemoryFree(osRtxInfo.mem.mq_data, mq->mp_info.block_base);
+    (void)osRtxMemoryFree(osRtxInfo.mem.mq_data, mq->mp_info.block_base);
   }
 
   // Free object memory
   if (mq->flags & osRtxFlagSystemObject) {
     if (osRtxInfo.mpi.message_queue != NULL) {
-      osRtxMemoryPoolFree(osRtxInfo.mpi.message_queue, mq);
+      (void)osRtxMemoryPoolFree(osRtxInfo.mpi.message_queue, mq);
     } else {
-      osRtxMemoryFree(osRtxInfo.mem.common, mq);
+      (void)osRtxMemoryFree(osRtxInfo.mem.common, mq);
     }
   }
 

+ 2 - 2
CMSIS/RTOS2/RTX/Source/rtx_mutex.c

@@ -420,9 +420,9 @@ osStatus_t svcRtxMutexDelete (osMutexId_t mutex_id) {
   // Free object memory
   if (mutex->flags & osRtxFlagSystemObject) {
     if (osRtxInfo.mpi.mutex != NULL) {
-      osRtxMemoryPoolFree(osRtxInfo.mpi.mutex, mutex);
+      (void)osRtxMemoryPoolFree(osRtxInfo.mpi.mutex, mutex);
     } else {
-      osRtxMemoryFree(osRtxInfo.mem.common, mutex);
+      (void)osRtxMemoryFree(osRtxInfo.mem.common, mutex);
     }
   }
 

+ 2 - 2
CMSIS/RTOS2/RTX/Source/rtx_semaphore.c

@@ -347,9 +347,9 @@ osStatus_t svcRtxSemaphoreDelete (osSemaphoreId_t semaphore_id) {
   // Free object memory
   if (semaphore->flags & osRtxFlagSystemObject) {
     if (osRtxInfo.mpi.semaphore != NULL) {
-      osRtxMemoryPoolFree(osRtxInfo.mpi.semaphore, semaphore);
+      (void)osRtxMemoryPoolFree(osRtxInfo.mpi.semaphore, semaphore);
     } else {
-      osRtxMemoryFree(osRtxInfo.mem.common, semaphore);
+      (void)osRtxMemoryFree(osRtxInfo.mem.common, semaphore);
     }
   }
 

+ 1 - 1
CMSIS/RTOS2/RTX/Source/rtx_system.c

@@ -205,6 +205,6 @@ void osRtxPostProcess (os_object_t *object) {
       osRtxInfo.kernel.pendSV = 1U;
     }
   } else {
-    osRtxErrorNotify(osRtxErrorISRQueueOverflow, object);
+    (void)osRtxErrorNotify(osRtxErrorISRQueueOverflow, object);
   }
 }

+ 12 - 12
CMSIS/RTOS2/RTX/Source/rtx_thread.c

@@ -516,7 +516,7 @@ __WEAK void osRtxThreadStackCheck (void) {
   if (thread != NULL) {
     if ((thread->sp <= (uint32_t)thread->stack_mem) ||
         (*((uint32_t *)thread->stack_mem) != osRtxStackMagicWord)) {
-      osRtxErrorNotify(osRtxErrorStackUnderflow, thread);
+      (void)osRtxErrorNotify(osRtxErrorStackUnderflow, thread);
     }
   }
 }
@@ -651,9 +651,9 @@ osThreadId_t svcRtxThreadNew (osThreadFunc_t func, void *argument, const osThrea
     if (stack_mem == NULL) {
       if (flags & osRtxFlagSystemObject) {
         if (osRtxInfo.mpi.thread != NULL) {
-          osRtxMemoryPoolFree(osRtxInfo.mpi.thread, thread);
+          (void)osRtxMemoryPoolFree(osRtxInfo.mpi.thread, thread);
         } else {
-          osRtxMemoryFree(osRtxInfo.mem.common, thread);
+          (void)osRtxMemoryFree(osRtxInfo.mem.common, thread);
         }
       }
       thread = NULL;
@@ -669,16 +669,16 @@ osThreadId_t svcRtxThreadNew (osThreadFunc_t func, void *argument, const osThrea
       EvrRtxThreadError(NULL, osRtxErrorTZ_AllocContext_S);
       if (flags & osRtxFlagSystemMemory) {
         if (flags & osRtxThreadFlagDefStack) {
-          osRtxMemoryPoolFree(osRtxInfo.mpi.stack, thread->stack_mem);
+          (void)osRtxMemoryPoolFree(osRtxInfo.mpi.stack, thread->stack_mem);
         } else {
-          osRtxMemoryFree(osRtxInfo.mem.stack, thread->stack_mem);
+          (void)osRtxMemoryFree(osRtxInfo.mem.stack, thread->stack_mem);
         }
       }
       if (flags & osRtxFlagSystemObject) {
         if (osRtxInfo.mpi.thread != NULL) {
-          osRtxMemoryPoolFree(osRtxInfo.mpi.thread, thread);
+          (void)osRtxMemoryPoolFree(osRtxInfo.mpi.thread, thread);
         } else {
-          osRtxMemoryFree(osRtxInfo.mem.common, thread);
+          (void)osRtxMemoryFree(osRtxInfo.mem.common, thread);
         }
       }
       thread = NULL;
@@ -1029,25 +1029,25 @@ static void osRtxThreadFree (os_thread_t *thread) {
 #if (DOMAIN_NS == 1)
   // Free secure process stack
   if (thread->tz_memory != 0U) {
-    TZ_FreeModuleContext_S(thread->tz_memory);
+    (void)TZ_FreeModuleContext_S(thread->tz_memory);
   }
 #endif
 
   // Free stack memory
   if (thread->flags & osRtxFlagSystemMemory) {
     if (thread->flags & osRtxThreadFlagDefStack) {
-      osRtxMemoryPoolFree(osRtxInfo.mpi.stack, thread->stack_mem);
+      (void)osRtxMemoryPoolFree(osRtxInfo.mpi.stack, thread->stack_mem);
     } else {
-      osRtxMemoryFree(osRtxInfo.mem.stack, thread->stack_mem);
+      (void)osRtxMemoryFree(osRtxInfo.mem.stack, thread->stack_mem);
     }
   }
 
   // Free object memory
   if (thread->flags & osRtxFlagSystemObject) {
     if (osRtxInfo.mpi.thread != NULL) {
-      osRtxMemoryPoolFree(osRtxInfo.mpi.thread, thread);
+      (void)osRtxMemoryPoolFree(osRtxInfo.mpi.thread, thread);
     } else {
-      osRtxMemoryFree(osRtxInfo.mem.common, thread);
+      (void)osRtxMemoryFree(osRtxInfo.mem.common, thread);
     }
   }
 }

+ 3 - 3
CMSIS/RTOS2/RTX/Source/rtx_timer.c

@@ -98,7 +98,7 @@ void osRtxTimerTick (void) {
     TimerUnlink(timer);
     status = osMessageQueuePut(osRtxInfo.timer.mq, &timer->finfo, 0U, 0U);
     if (status != osOK) {
-      osRtxErrorNotify(osRtxErrorTimerQueueOverflow, timer);
+      (void)osRtxErrorNotify(osRtxErrorTimerQueueOverflow, timer);
     }
     if (timer->type == osRtxTimerPeriodic) {
       TimerInsert(timer, timer->load);
@@ -331,9 +331,9 @@ osStatus_t svcRtxTimerDelete (osTimerId_t timer_id) {
   // Free object memory
   if (timer->flags & osRtxFlagSystemObject) {
     if (osRtxInfo.mpi.timer != NULL) {
-      osRtxMemoryPoolFree(osRtxInfo.mpi.timer, timer);
+      (void)osRtxMemoryPoolFree(osRtxInfo.mpi.timer, timer);
     } else {
-      osRtxMemoryFree(osRtxInfo.mem.common, timer);
+      (void)osRtxMemoryFree(osRtxInfo.mem.common, timer);
     }
   }
 

Some files were not shown because too many files changed in this diff