diff options
| author | TiejunZhou <[email protected]> | 2023-05-18 15:57:53 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2023-05-18 15:57:53 +0800 |
| commit | d66a519685d1842391b65e237b94a678cd6f65c3 (patch) | |
| tree | 5bac992cf9b610df1807863a3aa055d6b6240428 /common_smp/src | |
| parent | 6b8ece0ff28fb0160a2fdf51c09df09d587f4575 (diff) | |
Fix MISRA issues for ThreadX SMP (#263)
* Fixed MISRA2012 rule 10.4_a
The operands `pool_ptr->tx_byte_pool_fragments' and `2' have essential type categories unsigned 32-bit int and signed 8-bit int, which do not match.
* Fixed MISRA2012 rule 10.4_a
The operands `next_priority' and `TX_MAX_PRIORITIES' have essential type categories unsigned 32-bit int and signed 8-bit int, which do not match.
* Fixed MISRA2012 rule 8.3
Declaration/definition of `_tx_thread_smp_preemptable_threads_get' is inconsistent with previous declaration/definition in types and/or type qualifiers
Diffstat (limited to 'common_smp/src')
| -rw-r--r-- | common_smp/src/tx_byte_pool_search.c | 6 | ||||
| -rw-r--r-- | common_smp/src/tx_thread_smp_utilities.c | 2 | ||||
| -rw-r--r-- | common_smp/src/tx_thread_system_suspend.c | 6 |
3 files changed, 9 insertions, 5 deletions
diff --git a/common_smp/src/tx_byte_pool_search.c b/common_smp/src/tx_byte_pool_search.c index c40247f3..2bce4fc1 100644 --- a/common_smp/src/tx_byte_pool_search.c +++ b/common_smp/src/tx_byte_pool_search.c @@ -35,7 +35,7 @@ /* FUNCTION RELEASE */ /* */ /* _tx_byte_pool_search PORTABLE SMP */ -/* 6.1.7 */ +/* 6.x */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ @@ -81,6 +81,8 @@ /* calculation, and reduced */ /* number of search resets, */ /* resulting in version 6.1.7 */ +/* xx-xx-xxxx Tiejun Zhou Fixed MISRA2012 rule 10.4_a, */ +/* resulting in version 6.x */ /* */ /**************************************************************************/ UCHAR *_tx_byte_pool_search(TX_BYTE_POOL *pool_ptr, ULONG memory_size) @@ -110,7 +112,7 @@ UINT blocks_searched = ((UINT) 0); /* First, determine if there are enough bytes in the pool. */ /* Theoretical bytes available = free bytes + ((fragments-2) * overhead of each block) */ - total_theoretical_available = pool_ptr -> tx_byte_pool_available + ((pool_ptr -> tx_byte_pool_fragments - 2) * ((sizeof(UCHAR *)) + (sizeof(ALIGN_TYPE)))); + total_theoretical_available = pool_ptr -> tx_byte_pool_available + ((pool_ptr -> tx_byte_pool_fragments - 2U) * ((sizeof(UCHAR *)) + (sizeof(ALIGN_TYPE)))); if (memory_size >= total_theoretical_available) { diff --git a/common_smp/src/tx_thread_smp_utilities.c b/common_smp/src/tx_thread_smp_utilities.c index 8543e7be..b31914e6 100644 --- a/common_smp/src/tx_thread_smp_utilities.c +++ b/common_smp/src/tx_thread_smp_utilities.c @@ -826,7 +826,7 @@ TX_THREAD *thread_remap_list[TX_THREAD_SMP_MAX_CORES]; } -ULONG _tx_thread_smp_preemptable_threads_get(UINT priority, TX_THREAD *possible_preemption_list[]) +ULONG _tx_thread_smp_preemptable_threads_get(UINT priority, TX_THREAD *possible_preemption_list[TX_THREAD_SMP_MAX_CORES]) { UINT i, j, k; diff --git a/common_smp/src/tx_thread_system_suspend.c b/common_smp/src/tx_thread_system_suspend.c index a76a00d4..7de113c7 100644 --- a/common_smp/src/tx_thread_system_suspend.c +++ b/common_smp/src/tx_thread_system_suspend.c @@ -38,7 +38,7 @@ /* FUNCTION RELEASE */ /* */ /* _tx_thread_system_suspend PORTABLE SMP */ -/* 6.1.11 */ +/* 6.x */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ @@ -91,6 +91,8 @@ /* 04-25-2022 Scott Larson Modified comments and fixed */ /* loop to find next thread, */ /* resulting in version 6.1.11 */ +/* xx-xx-xxxx Tiejun Zhou Fixed MISRA2012 rule 10.4_a, */ +/* resulting in version 6.x */ /* */ /**************************************************************************/ VOID _tx_thread_system_suspend(TX_THREAD *thread_ptr) @@ -671,7 +673,7 @@ UINT processing_complete; complex_path_possible = possible_cores & available_cores; /* Check if we need to loop to find the next highest priority thread. */ - if (next_priority == TX_MAX_PRIORITIES) + if (next_priority == (ULONG)TX_MAX_PRIORITIES) { loop_finished = TX_TRUE; } |
