diff mbox series

[6/8] x86: Fix 64-bit compile warning

Message ID 20200422004507.2025-7-aiden.park@intel.com
State New
Headers show
Series Support 64-bit U-Boot for Slim Bootloader | expand

Commit Message

Park, Aiden April 22, 2020, 12:45 a.m. UTC
From: Aiden Park <aiden.park at intel.com>

This is to fix pointer type cast warning in hob command.

Signed-off-by: Aiden Park <aiden.park at intel.com>
---
 cmd/x86/hob.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Simon Glass April 26, 2020, 7:45 p.m. UTC | #1
Hi Aiden,

On Tue, 21 Apr 2020 at 18:45, <aiden.park at intel.com> wrote:
>
> From: Aiden Park <aiden.park at intel.com>
>
> This is to fix pointer type cast warning in hob command.
>
> Signed-off-by: Aiden Park <aiden.park at intel.com>
> ---
>  cmd/x86/hob.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/cmd/x86/hob.c b/cmd/x86/hob.c
> index 3967a7ca5a..8c2c1ffc63 100644
> --- a/cmd/x86/hob.c
> +++ b/cmd/x86/hob.c
> @@ -36,14 +36,14 @@ static int do_hob(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
>
>         hdr = gd->arch.hob_list;
>
> -       printf("HOB list address: 0x%08x\n\n", (unsigned int)hdr);
> +       printf("HOB list address: 0x%p\n\n", hdr);

That 0x should not be there as hex is assumed in U-Boot.

Do we actually need a 64-bit pointer here, or will the HOB be below
4GB? I'm really not a fan of 16-character addresses in a user command.

>
> -       printf("#  | Address  | Type      | Len  | ");
> +       printf("#  |          Address | Type      | Len  | ");
>         printf("%36s\n", "GUID");
> -       printf("---|----------|-----------|------|-");
> +       printf("---|------------------|-----------|------|-");
>         printf("------------------------------------\n");
>         while (!end_of_hob(hdr)) {
> -               printf("%02x | %08x | ", i, (unsigned int)hdr);
> +               printf("%02x | %p | ", i, hdr);
>                 type = hdr->type;
>                 if (type == HOB_TYPE_UNUSED)
>                         desc = "*Unused*";
> --
> 2.20.1
>

Regards,
Simon
Park, Aiden April 29, 2020, 6:08 a.m. UTC | #2
Hi Simon,

> -----Original Message-----
> From: Simon Glass <sjg at chromium.org>
> Sent: Sunday, April 26, 2020 12:46 PM
> To: Park, Aiden <aiden.park at intel.com>
> Cc: Bin Meng <bmeng.cn at gmail.com>; U-Boot Mailing List <u-
> boot at lists.denx.de>
> Subject: Re: [PATCH 6/8] x86: Fix 64-bit compile warning
> 
> Hi Aiden,
> 
> On Tue, 21 Apr 2020 at 18:45, <aiden.park at intel.com> wrote:
> >
> > From: Aiden Park <aiden.park at intel.com>
> >
> > This is to fix pointer type cast warning in hob command.
> >
> > Signed-off-by: Aiden Park <aiden.park at intel.com>
> > ---
> >  cmd/x86/hob.c | 8 ++++----
> >  1 file changed, 4 insertions(+), 4 deletions(-)
> >
> > diff --git a/cmd/x86/hob.c b/cmd/x86/hob.c index
> > 3967a7ca5a..8c2c1ffc63 100644
> > --- a/cmd/x86/hob.c
> > +++ b/cmd/x86/hob.c
> > @@ -36,14 +36,14 @@ static int do_hob(cmd_tbl_t *cmdtp, int flag, int
> > argc, char * const argv[])
> >
> >         hdr = gd->arch.hob_list;
> >
> > -       printf("HOB list address: 0x%08x\n\n", (unsigned int)hdr);
> > +       printf("HOB list address: 0x%p\n\n", hdr);
> 
> That 0x should not be there as hex is assumed in U-Boot.
Thanks. Let me remove the 0x prefix.

> 
> Do we actually need a 64-bit pointer here, or will the HOB be below 4GB? I'm
> really not a fan of 16-character addresses in a user command.
Currently, HOB is always below 4GB. This was just in case for 64-bit address space.
Let me assume HOB < 4GB for now.

> 
> >
> > -       printf("#  | Address  | Type      | Len  | ");
> > +       printf("#  |          Address | Type      | Len  | ");
> >         printf("%36s\n", "GUID");
> > -       printf("---|----------|-----------|------|-");
> > +       printf("---|------------------|-----------|------|-");
> >         printf("------------------------------------\n");
> >         while (!end_of_hob(hdr)) {
> > -               printf("%02x | %08x | ", i, (unsigned int)hdr);
> > +               printf("%02x | %p | ", i, hdr);
> >                 type = hdr->type;
> >                 if (type == HOB_TYPE_UNUSED)
> >                         desc = "*Unused*";
> > --
> > 2.20.1
> >
> 
> Regards,
> Simon

Best Regards,
Aiden
diff mbox series

Patch

diff --git a/cmd/x86/hob.c b/cmd/x86/hob.c
index 3967a7ca5a..8c2c1ffc63 100644
--- a/cmd/x86/hob.c
+++ b/cmd/x86/hob.c
@@ -36,14 +36,14 @@  static int do_hob(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 
 	hdr = gd->arch.hob_list;
 
-	printf("HOB list address: 0x%08x\n\n", (unsigned int)hdr);
+	printf("HOB list address: 0x%p\n\n", hdr);
 
-	printf("#  | Address  | Type      | Len  | ");
+	printf("#  |          Address | Type      | Len  | ");
 	printf("%36s\n", "GUID");
-	printf("---|----------|-----------|------|-");
+	printf("---|------------------|-----------|------|-");
 	printf("------------------------------------\n");
 	while (!end_of_hob(hdr)) {
-		printf("%02x | %08x | ", i, (unsigned int)hdr);
+		printf("%02x | %p | ", i, hdr);
 		type = hdr->type;
 		if (type == HOB_TYPE_UNUSED)
 			desc = "*Unused*";