[PATCH 17/17] MIPS: main_entry-pbl: fix conversion warnings on CONFIG_64BIT

Denis Orlov denorl2009 at gmail.com
Mon Jun 5 13:10:48 PDT 2023


Fix "cast from pointer to integer of different size" warnings by casting
pointers into unsigned long values when calculating sizes. While at it,
simplify code a bit, removing unnecessary variables and instead giving
another variable a more comprehensible name.

Signed-off-by: Denis Orlov <denorl2009 at gmail.com>
---
 arch/mips/boot/main_entry-pbl.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/arch/mips/boot/main_entry-pbl.c b/arch/mips/boot/main_entry-pbl.c
index 02ddd5ec24..f75ec03851 100644
--- a/arch/mips/boot/main_entry-pbl.c
+++ b/arch/mips/boot/main_entry-pbl.c
@@ -36,7 +36,7 @@ static void barebox_uncompress(void *compressed_start, unsigned int len)
 void __section(.text_entry) pbl_main_entry(void *fdt, void *fdt_end,
 					   u32 ram_size)
 {
-	u32 pg_start, pg_end, pg_len, fdt_len;
+	u32 piggy_len, fdt_len;
 	void *fdt_new;
 	void (*barebox)(void *fdt, u32 fdt_len, u32 ram_size);
 
@@ -45,13 +45,10 @@ void __section(.text_entry) pbl_main_entry(void *fdt, void *fdt_end,
 	/* clear bss */
 	memset(__bss_start, 0, __bss_stop - __bss_start);
 
-	pg_start = (u32)&input_data;
-	pg_end = (u32)&input_data_end;
-	pg_len = pg_end - pg_start;
+	piggy_len = (unsigned long)&input_data_end - (unsigned long)&input_data;
+	barebox_uncompress(&input_data, piggy_len);
 
-	barebox_uncompress(&input_data, pg_len);
-
-	fdt_len = (u32)fdt_end - (u32)fdt;
+	fdt_len = (unsigned long)fdt_end - (unsigned long)fdt;
 	fdt_new = (void *)PAGE_ALIGN_DOWN(TEXT_BASE - MALLOC_SIZE - STACK_SIZE - fdt_len);
 	memcpy(fdt_new, fdt, fdt_len);
 
-- 
2.41.0




More information about the barebox mailing list