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

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



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.

thanks,
-- Shuah


Attachment: signature.asc
Description: OpenPGP digital 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