devicetree-compiler.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Gibson <david-xT8FGy+AXnRB3Ne2BGzF6laj5H9X9Tb+@public.gmane.org>
To: Shuah Khan <shuahkh-JPH+aEBZ4P+UEJcrhfAQsw@public.gmane.org>
Cc: robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org,
	devicetree-compiler-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH] dtc: check.c fix compile error
Date: Wed, 17 May 2017 12:12:18 +1000	[thread overview]
Message-ID: <20170517021218.GC15596@umbus.fritz.box> (raw)
In-Reply-To: <20170516160808.8075-1-shuahkh-JPH+aEBZ4P+UEJcrhfAQsw@public.gmane.org>

[-- Attachment #1: Type: text/plain, Size: 1908 bytes --]

On Tue, May 16, 2017 at 10:08:08AM -0600, Shuah Khan wrote:
> Fix the following compile error found on odroid-xu4:
> 
> checks.c: In function ‘check_simple_bus_reg’:
> checks.c:876:41: error: format ‘%lx’ expects argument of type
> ‘long unsigned int’, but argument 4 has type
> ‘uint64_t{aka long long unsigned int}’ [-Werror=format=]
>   snprintf(unit_addr, sizeof(unit_addr), "%lx", reg);
>                                          ^
> checks.c:876:41: error: format ‘%lx’ expects argument of type
> ‘long unsigned int’, but argument 4 has type
> ‘uint64_t {aka long long unsigned int}’ [-Werror=format=]
> cc1: all warnings being treated as errors
> Makefile:304: recipe for target 'checks.o' failed
> make: *** [checks.o] Error 1
> 
> Signed-off-by: Shuah Khan <shuahkh-JPH+aEBZ4P+UEJcrhfAQsw@public.gmane.org>

The bug is real, but the fix is only correct for some platforms (just
as the original would only compile for some platforms).  I've adjusted
to %zx which should be right for all platforms and applied.

> ---
>  checks.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/checks.c b/checks.c
> index 5adfc8f..6dfb82f 100644
> --- a/checks.c
> +++ b/checks.c
> @@ -873,7 +873,7 @@ static void check_simple_bus_reg(struct check *c, struct dt_info *dti, struct no
>  	while (size--)
>  		reg = (reg << 32) | fdt32_to_cpu(*(cells++));
>  
> -	snprintf(unit_addr, sizeof(unit_addr), "%lx", reg);
> +	snprintf(unit_addr, sizeof(unit_addr), "%llx", reg);
>  	if (!streq(unitname, unit_addr))
>  		FAIL(c, dti, "Node %s simple-bus unit address format error, expected \"%s\"",
>  		     node->fullpath, unit_addr);

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

  parent reply	other threads:[~2017-05-17  2:12 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-16 16:08 [PATCH] dtc: check.c fix compile error Shuah Khan
     [not found] ` <20170516160808.8075-1-shuahkh-JPH+aEBZ4P+UEJcrhfAQsw@public.gmane.org>
2017-05-17  2:12   ` David Gibson [this message]
     [not found]     ` <20170517021218.GC15596-K0bRW+63XPQe6aEkudXLsA@public.gmane.org>
2017-05-17 13:42       ` Shuah Khan
2017-06-07 18:46       ` Shuah Khan
     [not found]         ` <db3a0ff9-bea2-4f6f-a1d6-34e8bc7ff44c-JPH+aEBZ4P+UEJcrhfAQsw@public.gmane.org>
2017-06-08  4:37           ` David Gibson

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=20170517021218.GC15596@umbus.fritz.box \
    --to=david-xt8fgy+axnrb3ne2bgzf6laj5h9x9tb+@public.gmane.org \
    --cc=devicetree-compiler-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=shuahkh-JPH+aEBZ4P+UEJcrhfAQsw@public.gmane.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;
as well as URLs for NNTP newsgroup(s).