diff mbox series

[9/9] board: sifive: Fix -Wint-to-pointer-cast warning

Message ID 20210912031516.24885-9-bmeng.cn@gmail.com
State Accepted
Commit b18c4ae82f266d81281d63ac58945d92ed67afde
Delegated to: Andes
Headers show
Series [1/9] cache: sifive: Fix -Wint-to-pointer-cast warning | expand

Commit Message

Bin Meng Sept. 12, 2021, 3:15 a.m. UTC
The following warning is seen in unleashed.c in a 32-bit build:

  warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]

Cast with uintptr_t.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
---

 board/sifive/unleashed/unleashed.c | 2 +-
 board/sifive/unmatched/unmatched.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

Comments

Leo Liang Sept. 15, 2021, 7:26 a.m. UTC | #1
On Sun, Sep 12, 2021 at 11:15:16AM +0800, Bin Meng wrote:
> The following warning is seen in unleashed.c in a 32-bit build:
> 
>   warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
> 
> Cast with uintptr_t.
> 
> Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
> ---
> 
>  board/sifive/unleashed/unleashed.c | 2 +-
>  board/sifive/unmatched/unmatched.c | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)

Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
diff mbox series

Patch

diff --git a/board/sifive/unleashed/unleashed.c b/board/sifive/unleashed/unleashed.c
index 33baeda986..e7d2332d8c 100644
--- a/board/sifive/unleashed/unleashed.c
+++ b/board/sifive/unleashed/unleashed.c
@@ -118,7 +118,7 @@  void *board_fdt_blob_setup(void)
 {
 	if (IS_ENABLED(CONFIG_OF_SEPARATE)) {
 		if (gd->arch.firmware_fdt_addr)
-			return (ulong *)gd->arch.firmware_fdt_addr;
+			return (ulong *)(uintptr_t)gd->arch.firmware_fdt_addr;
 	}
 
 	return (ulong *)&_end;
diff --git a/board/sifive/unmatched/unmatched.c b/board/sifive/unmatched/unmatched.c
index 8773b660fa..93c452c57f 100644
--- a/board/sifive/unmatched/unmatched.c
+++ b/board/sifive/unmatched/unmatched.c
@@ -15,7 +15,7 @@  void *board_fdt_blob_setup(void)
 {
 	if (IS_ENABLED(CONFIG_OF_SEPARATE)) {
 		if (gd->arch.firmware_fdt_addr)
-			return (ulong *)gd->arch.firmware_fdt_addr;
+			return (ulong *)(uintptr_t)gd->arch.firmware_fdt_addr;
 	}
 
 	return (ulong *)&_end;