[U-Boot] [PATCH 7/9] board: keymile: add explicit cast to truncate the 64bit ram size field

Philipp Tomsich philipp.tomsich at theobroma-systems.com
Thu Jul 26 13:59:49 UTC 2018


With the change to a 64bit ram size field for 32bit architectures, we need
to add an explicit cast to truncate when converting to a pointer.
This casts to 'void*' through 'uintptr_t'.

Signed-off-by: Philipp Tomsich <philipp.tomsich at theobroma-systems.com>
---

 board/keymile/km_arm/km_arm.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/board/keymile/km_arm/km_arm.c b/board/keymile/km_arm/km_arm.c
index ea03be9..13304cf 100644
--- a/board/keymile/km_arm/km_arm.c
+++ b/board/keymile/km_arm/km_arm.c
@@ -521,13 +521,15 @@ int post_hotkeys_pressed(void)
 
 ulong post_word_load(void)
 {
-	void* addr = (void *) (gd->ram_size - BOOTCOUNT_ADDR + POST_WORD_OFF);
+	void *addr = (void *)((uintptr_t)gd->ram_size -
+			      BOOTCOUNT_ADDR + POST_WORD_OFF);
 	return in_le32(addr);
 
 }
 void post_word_store(ulong value)
 {
-	void* addr = (void *) (gd->ram_size - BOOTCOUNT_ADDR + POST_WORD_OFF);
+	void *addr = (void *)((uintptr_t)gd->ram_size -
+			      BOOTCOUNT_ADDR + POST_WORD_OFF);
 	out_le32(addr, value);
 }
 
-- 
2.1.4



More information about the U-Boot mailing list