From 361ec32070d74af2747367699b7633deb95d7f96 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Wed, 27 Jan 2021 16:33:01 +0100 Subject: [PATCH] cacheimpl.h: Avoid potential dead code If CPU_DATA_CACHE_ALIGNMENT == CPU_INSTRUCTION_CACHE_ALIGNMENT we had dead code with the previous implementation. This fix relates to CID 1399776 (DEADCODE). --- bsps/shared/cache/cacheimpl.h | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/bsps/shared/cache/cacheimpl.h b/bsps/shared/cache/cacheimpl.h index 42ccdc14a7..3fceaba744 100644 --- a/bsps/shared/cache/cacheimpl.h +++ b/bsps/shared/cache/cacheimpl.h @@ -83,6 +83,8 @@ #include +#include + #if defined(RTEMS_SMP) && defined(CPU_CACHE_NO_INSTRUCTION_CACHE_SNOOPING) #include #include @@ -437,22 +439,19 @@ size_t rtems_cache_get_maximal_line_size( void ) #if defined(CPU_MAXIMAL_CACHE_ALIGNMENT) return CPU_MAXIMAL_CACHE_ALIGNMENT; #endif - size_t max_line_size = 0; + size_t data_line_size = #if defined(CPU_DATA_CACHE_ALIGNMENT) - { - size_t data_line_size = CPU_DATA_CACHE_ALIGNMENT; - if ( max_line_size < data_line_size ) - max_line_size = data_line_size; - } + CPU_DATA_CACHE_ALIGNMENT; +#else + 0; #endif + size_t instruction_line_size = #if defined(CPU_INSTRUCTION_CACHE_ALIGNMENT) - { - size_t instruction_line_size = CPU_INSTRUCTION_CACHE_ALIGNMENT; - if ( max_line_size < instruction_line_size ) - max_line_size = instruction_line_size; - } + CPU_INSTRUCTION_CACHE_ALIGNMENT; +#else + 0; #endif - return max_line_size; + return MAX( data_line_size, instruction_line_size ); } /*