Re: [PATCH] dtc: check.c fix compile error

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



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@xxxxxxxxxxxxxxx>
> > 
> > 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: signature.asc
Description: PGP signature


[Index of Archives]     [Device Tree]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux