mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: "Loïc Minier" <loic.minier@linaro.org>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH 4/5] Use %p in format for pointers
Date: Fri, 14 Oct 2011 09:18:50 +0200	[thread overview]
Message-ID: <20111014071850.GX13898@pengutronix.de> (raw)
In-Reply-To: <1318543601-20819-5-git-send-email-loic.minier@linaro.org>

On Fri, Oct 14, 2011 at 12:06:40AM +0200, Loïc Minier wrote:
> res->start and res->size are resource_type_t which is a phys_addr_t
> which itself could someday be a 64-bits pointer (for instance when
> building sandbox on a 64-bits host).  Instead of hardcoding %08x as a
> format for pointers, use the %p format.
> 
> Signed-off-by: Loïc Minier <loic.minier@linaro.org>
> ---
>  drivers/base/driver.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/base/driver.c b/drivers/base/driver.c
> index 0b80103..515ff8d 100644
> --- a/drivers/base/driver.c
> +++ b/drivers/base/driver.c
> @@ -349,8 +349,8 @@ static int do_devinfo(struct command *cmdtp, int argc, char *argv[])
>  			printf("num   : %d\n", i);
>  			if (res->name)
>  				printf("name  : %s\n", res->name);
> -			printf("start : 0x%08x\nsize  : 0x%08x\n",
> -			       res->start, res->size);
> +			printf("start : 0x%p\nsize  : 0x%p\n",
> +			       (void *)res->start, (void *)res->size);

With this patch I get the following warning on a 64bit host:

drivers/base/driver.c: In function ‘do_devinfo’:
drivers/base/driver.c:353:11: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
drivers/base/driver.c:353:31: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]

We should probably set CONFIG_PHYS_ADDR_T_64BIT correctly on a 64bit
host.

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  reply	other threads:[~2011-10-14  7:18 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-13 22:06 [RFC] Fix misc warnings when building sandbox on 64-bits Loïc Minier
2011-10-13 22:06 ` [PATCH 1/5] Only pass -P to cpp when generating ld scripts Loïc Minier
2011-10-13 22:06 ` [PATCH 2/5] Avoid warnings by using format(__printf__) Loïc Minier
2011-10-14  6:50   ` Sascha Hauer
2011-10-13 22:06 ` [PATCH 3/5] fprintf() returns an int Loïc Minier
2011-10-14  7:04   ` Sascha Hauer
2011-10-13 22:06 ` [PATCH 4/5] Use %p in format for pointers Loïc Minier
2011-10-14  7:18   ` Sascha Hauer [this message]
2011-10-14  7:22     ` Sascha Hauer
2011-10-13 22:06 ` [PATCH 5/5] Use size_t for memory offsets Loïc Minier
2011-10-14  7:20   ` Sascha Hauer
2011-10-14  8:59     ` Loïc Minier
2011-10-14 12:11       ` Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20111014071850.GX13898@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=loic.minier@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox