[U-Boot] [PATCH] samsung: board: fix: Define loop iterator as an unsigned int to suppress gcc 4.8 warning

Lukasz Majewski l.majewski at samsung.com
Wed Mar 4 10:54:48 CET 2015


This patch suppress following warning:

board/samsung/common/board.c:95:32: warning: iteration 4u invokes undefined behavior [-Waggressive-loop-optimizations]
   addr = CONFIG_SYS_SDRAM_BASE + (i * SDRAM_BANK_SIZE);
                                ^
board/samsung/common/board.c:94:2: note: containing loop

about possible signed integer overflow at gcc 4.8.2 (odroid board)

Signed-off-by: Lukasz Majewski <l.majewski at samsung.com>
---
 board/samsung/common/board.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/board/samsung/common/board.c b/board/samsung/common/board.c
index 7b10877..d8cf5ab 100644
--- a/board/samsung/common/board.c
+++ b/board/samsung/common/board.c
@@ -89,7 +89,7 @@ int board_init(void)
 
 int dram_init(void)
 {
-	int i;
+	unsigned int i;
 	u32 addr;
 
 	for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) {
@@ -101,7 +101,7 @@ int dram_init(void)
 
 void dram_init_banksize(void)
 {
-	int i;
+	unsigned int i;
 	u32 addr, size;
 
 	for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) {
-- 
2.0.0.rc2



More information about the U-Boot mailing list