From mboxrd@z Thu Jan 1 00:00:00 1970 From: Minkyu Kang Date: Wed, 04 Mar 2015 21:07:30 +0900 Subject: [U-Boot] [PATCH] samsung: board: fix: Define loop iterator as an unsigned int to suppress gcc 4.8 warning In-Reply-To: <1425462888-21190-1-git-send-email-l.majewski@samsung.com> References: <1425462888-21190-1-git-send-email-l.majewski@samsung.com> Message-ID: <54F6F582.5080609@samsung.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On 04/03/15 18:54, Lukasz Majewski wrote: > 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 > --- > 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++) { > applied to u-boot-samsung. Thanks, Minkyu Kang.