diff mbox series

[1/1] common/board_f: avoid -Wtype-limits warning

Message ID 20200509192114.146747-1-xypron.glpk@gmx.de
State Accepted
Commit 542809620e62a3fc2f93c230440c6d105e59b32e
Headers show
Series [1/1] common/board_f: avoid -Wtype-limits warning | expand

Commit Message

Heinrich Schuchardt May 9, 2020, 7:21 p.m. UTC
CONFIG_SYS_SDRAM_BASE maybe zero. Avoid a build warning when compiling with
-Wtype-limits.

Signed-off-by: Heinrich Schuchardt <xypron.glpk at gmx.de>
---
 common/board_f.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--
2.26.2

Comments

Simon Glass May 10, 2020, 8:36 p.m. UTC | #1
On Sat, 9 May 2020 at 13:27, Heinrich Schuchardt <xypron.glpk at gmx.de> wrote:
>
> CONFIG_SYS_SDRAM_BASE maybe zero. Avoid a build warning when compiling with
> -Wtype-limits.
>
> Signed-off-by: Heinrich Schuchardt <xypron.glpk at gmx.de>
> ---
>  common/board_f.c | 2 +-

Reviewed-by: Simon Glass <sjg at chromium.org>
Tom Rini May 15, 2020, 8:54 p.m. UTC | #2
On Sat, May 09, 2020 at 09:21:14PM +0200, Heinrich Schuchardt wrote:

> CONFIG_SYS_SDRAM_BASE maybe zero. Avoid a build warning when compiling with
> -Wtype-limits.
> 
> Signed-off-by: Heinrich Schuchardt <xypron.glpk at gmx.de>
> Reviewed-by: Simon Glass <sjg at chromium.org>

Applied to u-boot/master, thanks!
diff mbox series

Patch

diff --git a/common/board_f.c b/common/board_f.c
index 5c650f046c..cf93f70f74 100644
--- a/common/board_f.c
+++ b/common/board_f.c
@@ -309,7 +309,7 @@  __weak int mach_cpu_init(void)
 /* Get the top of usable RAM */
 __weak ulong board_get_usable_ram_top(ulong total_size)
 {
-#ifdef CONFIG_SYS_SDRAM_BASE
+#if defined(CONFIG_SYS_SDRAM_BASE) && CONFIG_SYS_SDRAM_BASE > 0
 	/*
 	 * Detect whether we have so much RAM that it goes past the end of our
 	 * 32-bit address space. If so, clip the usable RAM so it doesn't.