[PATCH 2/2] common: splash_source: Fix type casting errors.
Devarsh Thakkar
devarsht at ti.com
Mon Jun 19 11:59:12 CEST 2023
Hi Nikhil,
On 19/06/23 15:14, Nikhil M Jain wrote:
> 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
> their type to uintptr_t to mitigate the warnings.
s/mitigate/fix
>
> 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);
>
> Signed-off-by: Nikhil M Jain <n-jain1 at ti.com>
> ---
> common/splash_source.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/common/splash_source.c b/common/splash_source.c
> index a260137619..53f2c7034b 100644
> --- a/common/splash_source.c
> +++ b/common/splash_source.c
> @@ -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)
>
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
> /* 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;
>
More information about the U-Boot
mailing list