Skip to content

Commit d94db2d

Browse files
bradleysmith23bjbsmithchinglee-iot
authored
Fix MISRA C 2012 Rule 10.3 Violations (FreeRTOS#974)
* Resolve violations for MISRA Rule 10.3-b2 * Formatting fix --------- Co-authored-by: bjbsmith <[email protected]> Co-authored-by: chinglee-iot <[email protected]>
1 parent cd8c6c1 commit d94db2d

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

portable/Common/mpu_wrappers_v2.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2964,7 +2964,7 @@
29642964
QueueHandle_t xInternalQueueHandle = NULL;
29652965
BaseType_t xReturn = pdFAIL;
29662966

2967-
lIndex = ( uint32_t ) xQueue;
2967+
lIndex = ( int32_t ) xQueue;
29682968

29692969
if( IS_EXTERNAL_INDEX_VALID( lIndex ) != pdFALSE )
29702970
{

queue.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1190,7 +1190,7 @@ BaseType_t xQueueGenericSendFromISR( QueueHandle_t xQueue,
11901190
* read, instead return a flag to say whether a context switch is required or
11911191
* not (i.e. has a task with a higher priority than us been woken by this
11921192
* post). */
1193-
uxSavedInterruptStatus = taskENTER_CRITICAL_FROM_ISR();
1193+
uxSavedInterruptStatus = ( UBaseType_t ) taskENTER_CRITICAL_FROM_ISR();
11941194
{
11951195
if( ( pxQueue->uxMessagesWaiting < pxQueue->uxLength ) || ( xCopyPosition == queueOVERWRITE ) )
11961196
{
@@ -1365,7 +1365,7 @@ BaseType_t xQueueGiveFromISR( QueueHandle_t xQueue,
13651365
* link: https://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html */
13661366
portASSERT_IF_INTERRUPT_PRIORITY_INVALID();
13671367

1368-
uxSavedInterruptStatus = taskENTER_CRITICAL_FROM_ISR();
1368+
uxSavedInterruptStatus = ( UBaseType_t ) taskENTER_CRITICAL_FROM_ISR();
13691369
{
13701370
const UBaseType_t uxMessagesWaiting = pxQueue->uxMessagesWaiting;
13711371

@@ -2055,7 +2055,7 @@ BaseType_t xQueueReceiveFromISR( QueueHandle_t xQueue,
20552055
* link: https://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html */
20562056
portASSERT_IF_INTERRUPT_PRIORITY_INVALID();
20572057

2058-
uxSavedInterruptStatus = taskENTER_CRITICAL_FROM_ISR();
2058+
uxSavedInterruptStatus = ( UBaseType_t ) taskENTER_CRITICAL_FROM_ISR();
20592059
{
20602060
const UBaseType_t uxMessagesWaiting = pxQueue->uxMessagesWaiting;
20612061

@@ -2153,7 +2153,7 @@ BaseType_t xQueuePeekFromISR( QueueHandle_t xQueue,
21532153
* link: https://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html */
21542154
portASSERT_IF_INTERRUPT_PRIORITY_INVALID();
21552155

2156-
uxSavedInterruptStatus = taskENTER_CRITICAL_FROM_ISR();
2156+
uxSavedInterruptStatus = ( UBaseType_t ) taskENTER_CRITICAL_FROM_ISR();
21572157
{
21582158
/* Cannot block in an ISR, so check there is data available. */
21592159
if( pxQueue->uxMessagesWaiting > ( UBaseType_t ) 0 )

tasks.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2657,7 +2657,7 @@ static void prvInitialiseNewTask( TaskFunction_t pxTaskCode,
26572657
* https://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html */
26582658
portASSERT_IF_INTERRUPT_PRIORITY_INVALID();
26592659

2660-
uxSavedInterruptStatus = taskENTER_CRITICAL_FROM_ISR();
2660+
uxSavedInterruptStatus = ( UBaseType_t ) taskENTER_CRITICAL_FROM_ISR();
26612661
{
26622662
/* If null is passed in here then it is the priority of the calling
26632663
* task that is being queried. */
@@ -2728,7 +2728,7 @@ static void prvInitialiseNewTask( TaskFunction_t pxTaskCode,
27282728
* https://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html */
27292729
portASSERT_IF_INTERRUPT_PRIORITY_INVALID();
27302730

2731-
uxSavedInterruptStatus = taskENTER_CRITICAL_FROM_ISR();
2731+
uxSavedInterruptStatus = ( UBaseType_t ) taskENTER_CRITICAL_FROM_ISR();
27322732
{
27332733
/* If null is passed in here then it is the base priority of the calling
27342734
* task that is being queried. */
@@ -4657,7 +4657,7 @@ BaseType_t xTaskCatchUpTicks( TickType_t xTicksToCatchUp )
46574657
/* This lets the task know it was forcibly removed from the
46584658
* blocked state so it should not re-evaluate its block time and
46594659
* then block again. */
4660-
pxTCB->ucDelayAborted = pdTRUE;
4660+
pxTCB->ucDelayAborted = ( uint8_t ) pdTRUE;
46614661
}
46624662
else
46634663
{
@@ -5598,7 +5598,7 @@ BaseType_t xTaskCheckForTimeOut( TimeOut_t * const pxTimeOut,
55985598
{
55995599
/* The delay was aborted, which is not the same as a time out,
56005600
* but has the same result. */
5601-
pxCurrentTCB->ucDelayAborted = pdFALSE;
5601+
pxCurrentTCB->ucDelayAborted = ( uint8_t ) pdFALSE;
56025602
xReturn = pdTRUE;
56035603
}
56045604
else
@@ -8064,7 +8064,7 @@ TickType_t uxTaskResetEventItemValue( void )
80648064

80658065
pxTCB = xTaskToNotify;
80668066

8067-
uxSavedInterruptStatus = taskENTER_CRITICAL_FROM_ISR();
8067+
uxSavedInterruptStatus = ( UBaseType_t ) taskENTER_CRITICAL_FROM_ISR();
80688068
{
80698069
if( pulPreviousNotificationValue != NULL )
80708070
{
@@ -8223,7 +8223,7 @@ TickType_t uxTaskResetEventItemValue( void )
82238223

82248224
pxTCB = xTaskToNotify;
82258225

8226-
uxSavedInterruptStatus = taskENTER_CRITICAL_FROM_ISR();
8226+
uxSavedInterruptStatus = ( UBaseType_t ) taskENTER_CRITICAL_FROM_ISR();
82278227
{
82288228
ucOriginalNotifyState = pxTCB->ucNotifyState[ uxIndexToNotify ];
82298229
pxTCB->ucNotifyState[ uxIndexToNotify ] = taskNOTIFICATION_RECEIVED;
@@ -8497,7 +8497,7 @@ static void prvAddCurrentTaskToDelayedList( TickType_t xTicksToWait,
84978497
/* About to enter a delayed list, so ensure the ucDelayAborted flag is
84988498
* reset to pdFALSE so it can be detected as having been set to pdTRUE
84998499
* when the task leaves the Blocked state. */
8500-
pxCurrentTCB->ucDelayAborted = pdFALSE;
8500+
pxCurrentTCB->ucDelayAborted = ( uint8_t ) pdFALSE;
85018501
}
85028502
#endif
85038503

0 commit comments

Comments
 (0)