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

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



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.

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: 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