* [PATCH] dtc: check.c fix compile error
@ 2017-05-16 16:08 Shuah Khan
[not found] ` <20170516160808.8075-1-shuahkh-JPH+aEBZ4P+UEJcrhfAQsw@public.gmane.org>
0 siblings, 1 reply; 5+ messages in thread
From: Shuah Khan @ 2017-05-16 16:08 UTC (permalink / raw)
To: robh+dt-DgEjT+Ai2ygdnm+yROfE0A,
devicetree-compiler-u79uwXL29TY76Z2rM5mHXA
Cc: Shuah Khan
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>
---
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);
--
2.7.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] dtc: check.c fix compile error
[not found] ` <20170516160808.8075-1-shuahkh-JPH+aEBZ4P+UEJcrhfAQsw@public.gmane.org>
@ 2017-05-17 2:12 ` David Gibson
[not found] ` <20170517021218.GC15596-K0bRW+63XPQe6aEkudXLsA@public.gmane.org>
0 siblings, 1 reply; 5+ messages in thread
From: David Gibson @ 2017-05-17 2:12 UTC (permalink / raw)
To: Shuah Khan
Cc: robh+dt-DgEjT+Ai2ygdnm+yROfE0A,
devicetree-compiler-u79uwXL29TY76Z2rM5mHXA
[-- 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 --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] dtc: check.c fix compile error
[not found] ` <20170517021218.GC15596-K0bRW+63XPQe6aEkudXLsA@public.gmane.org>
@ 2017-05-17 13:42 ` Shuah Khan
2017-06-07 18:46 ` Shuah Khan
1 sibling, 0 replies; 5+ messages in thread
From: Shuah Khan @ 2017-05-17 13:42 UTC (permalink / raw)
To: David Gibson
Cc: robh+dt-DgEjT+Ai2ygdnm+yROfE0A,
devicetree-compiler-u79uwXL29TY76Z2rM5mHXA, shuah Khan
[-- Attachment #1.1: Type: text/plain, Size: 1836 bytes --]
On 05/16/2017 08:12 PM, David Gibson wrote:
> 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.
Thanks David,
-- Shuah
>
>> ---
>> 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);
>
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 801 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] dtc: check.c fix compile error
[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>
1 sibling, 1 reply; 5+ messages in thread
From: Shuah Khan @ 2017-06-07 18:46 UTC (permalink / raw)
To: David Gibson
Cc: robh+dt-DgEjT+Ai2ygdnm+yROfE0A,
devicetree-compiler-u79uwXL29TY76Z2rM5mHXA, Shuah Khan
[-- Attachment #1.1: Type: text/plain, Size: 2060 bytes --]
Hi David,
On 05/16/2017 08:12 PM, David Gibson wrote:
> 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.
This patch with %zx made it into Linux 4.12-rc4 and I am seeing these
warnings:
HOSTCC scripts/dtc/checks.o
scripts/dtc/checks.c: In function ‘check_simple_bus_reg’:
scripts/dtc/checks.c:876:41: warning: format ‘%zx’ expects argument of type ‘size_t’, but argument 4 has type ‘uint64_t {aka long long unsigned int}’ [-Wformat=]
snprintf(unit_addr, sizeof(unit_addr), "%zx", reg);
^
scripts/dtc/checks.c:876:41: warning: format ‘%zx’ expects argument of type ‘size_t’, but argument 4 has type ‘uint64_t {aka long long unsigned int}’ [-Wformat=]
HOSTLD scripts/dtc/dtc
CHK scripts/mod/devicetable-offsets.h
build doesn't fail, which is good. This probably needs fixing,
but since my fix using %llx fails on some platforms, I am just
reporting the problem, instead of attempting to fix.
thanks,
-- Shuah
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 801 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] dtc: check.c fix compile error
[not found] ` <db3a0ff9-bea2-4f6f-a1d6-34e8bc7ff44c-JPH+aEBZ4P+UEJcrhfAQsw@public.gmane.org>
@ 2017-06-08 4:37 ` David Gibson
0 siblings, 0 replies; 5+ messages in thread
From: David Gibson @ 2017-06-08 4:37 UTC (permalink / raw)
To: Shuah Khan
Cc: robh+dt-DgEjT+Ai2ygdnm+yROfE0A,
devicetree-compiler-u79uwXL29TY76Z2rM5mHXA
[-- Attachment #1: Type: text/plain, Size: 2625 bytes --]
On Wed, Jun 07, 2017 at 12:46:52PM -0600, Shuah Khan wrote:
> Hi David,
>
> On 05/16/2017 08:12 PM, David Gibson wrote:
> > 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.
> This patch with %zx made it into Linux 4.12-rc4 and I am seeing these
> warnings:
>
> HOSTCC scripts/dtc/checks.o
> scripts/dtc/checks.c: In function ‘check_simple_bus_reg’:
> scripts/dtc/checks.c:876:41: warning: format ‘%zx’ expects argument of type ‘size_t’, but argument 4 has type ‘uint64_t {aka long long unsigned int}’ [-Wformat=]
> snprintf(unit_addr, sizeof(unit_addr), "%zx", reg);
> ^
> scripts/dtc/checks.c:876:41: warning: format ‘%zx’ expects argument of type ‘size_t’, but argument 4 has type ‘uint64_t {aka long long unsigned int}’ [-Wformat=]
> HOSTLD scripts/dtc/dtc
> CHK scripts/mod/devicetable-offsets.h
>
>
> build doesn't fail, which is good. This probably needs fixing,
> but since my fix using %llx fails on some platforms, I am just
> reporting the problem, instead of attempting to fix.
*facepalm*
Sorry. I "corrected" your patch from one wrong thing to a different
wrong thing. Apparently I thought the parameter was of type size_t,
rather than uint64_t.
I've now fixed this in my master branch. This time for sure. I hope.
--
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 --]
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2017-06-08 4:37 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
[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
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).