summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2021-01-27 16:33:01 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2021-01-27 19:02:03 +0100
commit361ec32070d74af2747367699b7633deb95d7f96 (patch)
treeb4bef0709fbacadf01446b0b49496688d1b5e8cf
parentUpdate copyright notice to 2021 (diff)
downloadrtems-361ec32070d74af2747367699b7633deb95d7f96.tar.bz2
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).
-rw-r--r--bsps/shared/cache/cacheimpl.h23
1 files 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 <rtems.h>
+#include <sys/param.h>
+
#if defined(RTEMS_SMP) && defined(CPU_CACHE_NO_INSTRUCTION_CACHE_SNOOPING)
#include <rtems/score/smpimpl.h>
#include <rtems/score/threaddispatch.h>
@@ -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 );
}
/*