Skip to contentSkip to conversation

Mitigate warnings occurred during compilation

PATCH Superseded Nikhil M Jain 3 participants 6 messages Jun 19, 2023 – Jun 21, 2023

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover Mitigate warnings occurred during compilation

This patch series aims at mitigating warnings occurred during compilation by including required header files and using appropriate types for variables which are typecasted.

Nikhil M Jain (2):
board: ti: am62x: evm: Include necessary header files
common: splash_source: Fix type casting errors.

 board/ti/am62x/evm.c   | 1 +
 common/splash_source.c | 4 ++--
 2 files changed, 3 insertions(+), 2 deletions(-)
Signature · 1 line
2.34.1
#1 lore raw

PATCH 1/2 board: ti: am62x: evm: Include necessary header files

At the time of compilation evm.c gives below warning for implicit declaration of enable_caches, to mitigate this include cpu_func.h.

board/ti/am62x/evm.c: In function ‘spl_board_init’:
board/ti/am62x/evm.c:90:9: warning: implicit declaration of function ‘enable_caches’ [-Wimplicit-function-declaration]
90 | enable_caches();

---
 board/ti/am62x/evm.c | 1 +
 1 file changed, 1 insertion(+)
board/ti/am62x/evm.c +1 -0
index d3c1786cd9..ad93908840 100644
@@ -12,6 +12,7 @@
 #include <init.h>
 #include <video.h>
 #include <splash.h>
+#include <cpu_func.h>
 #include <k3-ddrss.h>
 #include <fdt_support.h>
 #include <asm/io.h>
Signature · 1 line
2.34.1
#2 lore raw

PATCH 2/2 common: splash_source: Fix type casting errors.

In reply to Nikhil M Jain

During compilation splash_source puts out below warning for type conversion in splash_load_fit for bmp_load_addr and fit_header, change their type to uintptr_t to mitigate the warnings.

common/splash_source.c: In function ‘splash_load_fit’:
common/splash_source.c:366:22: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
366 | img_header = (struct legacy_img_hdr *)bmp_load_addr;
| ^
common/splash_source.c:376:49: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
376 | res = splash_storage_read_raw(location, (u32)fit_header, fit_size);
| ^
common/splash_source.c:401:25: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
401 | memmove((void *)bmp_load_addr, internal_splash_data, internal_splash_size);

---
 common/splash_source.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
common/splash_source.c +2 -2
index a260137619..53f2c7034b 100644
@@ -343,7 +343,7 @@ static struct splash_location *select_splash_location(
 }
 
 #ifdef CONFIG_FIT
-static int splash_load_fit(struct splash_location *location, u32 bmp_load_addr)
+static int splash_load_fit(struct splash_location *location, uintptr_t bmp_load_addr)
 {
 	int res;
 	int node_offset;
@@ -373,7 +373,7 @@ static int splash_load_fit(struct splash_location *location, u32 bmp_load_addr)
 
 	/* Read in entire FIT */
 	fit_header = (const u32 *)(bmp_load_addr + header_size);
-	res = splash_storage_read_raw(location, (u32)fit_header, fit_size);
+	res = splash_storage_read_raw(location, (uintptr_t)fit_header, fit_size);
 	if (res < 0)
 		return res;
 
Signature · 1 line
2.34.1
#3 lore raw

Re: [PATCH 2/2] common: splash_source: Fix type casting errors.

Hi Nikhil,

Quoted 2 lines · Nikhil M Jain

During compilation splash_source puts out below warning for type conversion in splash_load_fit for bmp_load_addr and fit_header,

Below should be separate sentence. Also remove fullstop from subject line.
change

Quoted 1 line

their type to uintptr_t to mitigate the warnings.

s/mitigate/fix

Quoted 30 lines

common/splash_source.c: In function ‘splash_load_fit’:
common/splash_source.c:366:22: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
366 | img_header = (struct legacy_img_hdr *)bmp_load_addr;
| ^
common/splash_source.c:376:49: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
376 | res = splash_storage_read_raw(location, (u32)fit_header, fit_size);
| ^
common/splash_source.c:401:25: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
401 | memmove((void *)bmp_load_addr, internal_splash_data, internal_splash_size);

---
 common/splash_source.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
common/splash_source.c +1 -1
index a260137619..53f2c7034b 100644
@@ -343,7 +343,7 @@ static struct splash_location *select_splash_location(
 }
 
 #ifdef CONFIG_FIT
-static int splash_load_fit(struct splash_location *location, u32 bmp_load_addr)
+static int splash_load_fit(struct splash_location *location, uintptr_t bmp_load_addr)
 {
 	int res;
 	int node_offset;

common/splash_source.c static int splash_load_fit(struct splash_location *location, u32 bmp_load_addr) · line 373

Quoted 1 line
common/splash_source.c +0 -0
@@ -373,7 +373,7 @@ static int splash_load_fit(struct splash_location *location, u32 bmp_load_addr)
 

In my opinion better to use uintptr_t for bmp_load_addr or for the matter any other address being used at all places in splash files.

Regards
Devarsh

Quoted 7 lines
common/splash_source.c +1 -1
 	/* Read in entire FIT */
 	fit_header = (const u32 *)(bmp_load_addr + header_size);
-	res = splash_storage_read_raw(location, (u32)fit_header, fit_size);
+	res = splash_storage_read_raw(location, (uintptr_t)fit_header, fit_size);
 	if (res < 0)
 		return res;
 
#4 lore raw
In reply to Nikhil M Jain
Quoted 11 lines · Nikhil M Jain

This patch series aims at mitigating warnings occurred during compilation by including required header files and using appropriate types for variables which are typecasted.

Nikhil M Jain (2):
board: ti: am62x: evm: Include necessary header files
common: splash_source: Fix type casting errors.

 board/ti/am62x/evm.c   | 1 +
 common/splash_source.c | 4 ++--
 2 files changed, 3 insertions(+), 2 deletions(-)

What is this on top of, or what changes have been made to stock defconfigs to make these problems appear?

Signature · 1 line
Tom
#5 lore raw

Hi Tom,

Quoted 9 lines · Tom Rini
Quoted 8 lines · Nikhil M Jain

This patch series aims at mitigating warnings occurred during compilation by including required header files and using appropriate types for variables which are typecasted.

Nikhil M Jain (2):
board: ti: am62x: evm: Include necessary header files
common: splash_source: Fix type casting errors.

Quoted 7 lines
Quoted 3 lines
  board/ti/am62x/evm.c   | 1 +
  common/splash_source.c | 4 ++--
  2 files changed, 3 insertions(+), 2 deletions(-)

What is this on top of, or what changes have been made to stock defconfigs to make these problems appear?

These errors appear when you enable CONFIG_SPLASH_SOURCE and CONFIG_FIT is enabled.

Thanks,
Nikhil