mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] MIPS: bootm: fix format string type mismatch
@ 2023-09-12  9:58 Ahmad Fatoum
  2023-09-12 10:56 ` Sascha Hauer
  0 siblings, 1 reply; 4+ messages in thread
From: Ahmad Fatoum @ 2023-09-12  9:58 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

While we always have sizeof (struct device_node *) == sizeof(ulong),
clangd warns about mixing them as arguments to functions with printf-style
format strings. Add a cast to silence the warning.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 arch/mips/lib/bootm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/mips/lib/bootm.c b/arch/mips/lib/bootm.c
index 19d82ec37530..a5bfc6c88c17 100644
--- a/arch/mips/lib/bootm.c
+++ b/arch/mips/lib/bootm.c
@@ -62,7 +62,7 @@ static int do_bootm_elf(struct image_data *data)
 	}
 
 	pr_info("Starting application at 0x%08lx, dts 0x%08lx...\n",
-		data->os_address, data->of_root_node);
+		data->os_address, (ulong)data->of_root_node);
 
 	if (data->dryrun)
 		goto bootm_free_fdt;
-- 
2.39.2




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] MIPS: bootm: fix format string type mismatch
  2023-09-12  9:58 [PATCH] MIPS: bootm: fix format string type mismatch Ahmad Fatoum
@ 2023-09-12 10:56 ` Sascha Hauer
  2023-09-12 11:00   ` Ahmad Fatoum
  0 siblings, 1 reply; 4+ messages in thread
From: Sascha Hauer @ 2023-09-12 10:56 UTC (permalink / raw)
  To: Ahmad Fatoum; +Cc: barebox

On Tue, Sep 12, 2023 at 11:58:09AM +0200, Ahmad Fatoum wrote:
> While we always have sizeof (struct device_node *) == sizeof(ulong),
> clangd warns about mixing them as arguments to functions with printf-style
> format strings. Add a cast to silence the warning.
> 
> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
> ---
>  arch/mips/lib/bootm.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/mips/lib/bootm.c b/arch/mips/lib/bootm.c
> index 19d82ec37530..a5bfc6c88c17 100644
> --- a/arch/mips/lib/bootm.c
> +++ b/arch/mips/lib/bootm.c
> @@ -62,7 +62,7 @@ static int do_bootm_elf(struct image_data *data)
>  	}
>  
>  	pr_info("Starting application at 0x%08lx, dts 0x%08lx...\n",
> -		data->os_address, data->of_root_node);
> +		data->os_address, (ulong)data->of_root_node);

It's a pointer, so why not print it with 0x%p?

Sascha

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] MIPS: bootm: fix format string type mismatch
  2023-09-12 10:56 ` Sascha Hauer
@ 2023-09-12 11:00   ` Ahmad Fatoum
  2023-09-12 11:12     ` Sascha Hauer
  0 siblings, 1 reply; 4+ messages in thread
From: Ahmad Fatoum @ 2023-09-12 11:00 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: barebox

On 12.09.23 12:56, Sascha Hauer wrote:
> On Tue, Sep 12, 2023 at 11:58:09AM +0200, Ahmad Fatoum wrote:
>> While we always have sizeof (struct device_node *) == sizeof(ulong),
>> clangd warns about mixing them as arguments to functions with printf-style
>> format strings. Add a cast to silence the warning.
>>
>> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
>> ---
>>  arch/mips/lib/bootm.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/arch/mips/lib/bootm.c b/arch/mips/lib/bootm.c
>> index 19d82ec37530..a5bfc6c88c17 100644
>> --- a/arch/mips/lib/bootm.c
>> +++ b/arch/mips/lib/bootm.c
>> @@ -62,7 +62,7 @@ static int do_bootm_elf(struct image_data *data)
>>  	}
>>  
>>  	pr_info("Starting application at 0x%08lx, dts 0x%08lx...\n",
>> -		data->os_address, data->of_root_node);
>> +		data->os_address, (ulong)data->of_root_node);
> 
> It's a pointer, so why not print it with 0x%p?

I have an aversion towards 0x%p, because ISO C leaves it implementation defined
whether %p includes a 0x or not. We have our own %p though, so I don't mind if
you change it while applying.

Cheers,
Ahmad

> 
> Sascha
> 

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] MIPS: bootm: fix format string type mismatch
  2023-09-12 11:00   ` Ahmad Fatoum
@ 2023-09-12 11:12     ` Sascha Hauer
  0 siblings, 0 replies; 4+ messages in thread
From: Sascha Hauer @ 2023-09-12 11:12 UTC (permalink / raw)
  To: Ahmad Fatoum; +Cc: barebox

On Tue, Sep 12, 2023 at 01:00:22PM +0200, Ahmad Fatoum wrote:
> On 12.09.23 12:56, Sascha Hauer wrote:
> > On Tue, Sep 12, 2023 at 11:58:09AM +0200, Ahmad Fatoum wrote:
> >> While we always have sizeof (struct device_node *) == sizeof(ulong),
> >> clangd warns about mixing them as arguments to functions with printf-style
> >> format strings. Add a cast to silence the warning.
> >>
> >> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
> >> ---
> >>  arch/mips/lib/bootm.c | 2 +-
> >>  1 file changed, 1 insertion(+), 1 deletion(-)
> >>
> >> diff --git a/arch/mips/lib/bootm.c b/arch/mips/lib/bootm.c
> >> index 19d82ec37530..a5bfc6c88c17 100644
> >> --- a/arch/mips/lib/bootm.c
> >> +++ b/arch/mips/lib/bootm.c
> >> @@ -62,7 +62,7 @@ static int do_bootm_elf(struct image_data *data)
> >>  	}
> >>  
> >>  	pr_info("Starting application at 0x%08lx, dts 0x%08lx...\n",
> >> -		data->os_address, data->of_root_node);
> >> +		data->os_address, (ulong)data->of_root_node);
> > 
> > It's a pointer, so why not print it with 0x%p?
> 
> I have an aversion towards 0x%p, because ISO C leaves it implementation defined
> whether %p includes a 0x or not. We have our own %p though, so I don't mind if
> you change it while applying.

Did that, thanks

Sascha

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-09-12 11:14 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-12  9:58 [PATCH] MIPS: bootm: fix format string type mismatch Ahmad Fatoum
2023-09-12 10:56 ` Sascha Hauer
2023-09-12 11:00   ` Ahmad Fatoum
2023-09-12 11:12     ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox