diff mbox

powerpc: fix wii_memory_fixups() compile error on 3.0.y tree

Message ID 1354932445.7407.15.camel@lorien2 (mailing list archive)
State Rejected
Headers show

Commit Message

Shuah Khan Dec. 8, 2012, 2:07 a.m. UTC
Fix wii_memory_fixups() the following compile error on 3.0.y tree with 
wii_defconfig on 3.0.y tree.

  CC      arch/powerpc/platforms/embedded6xx/wii.o
arch/powerpc/platforms/embedded6xx/wii.c: In function ‘wii_memory_fixups’:
arch/powerpc/platforms/embedded6xx/wii.c:88:2: error: format ‘%llx’ expects argument of type ‘long long unsigned int’, but argument 2 has type ‘phys_addr_t’ [-Werror=format]
arch/powerpc/platforms/embedded6xx/wii.c:88:2: error: format ‘%llx’ expects argument of type ‘long long unsigned int’, but argument 3 has type ‘phys_addr_t’ [-Werror=format]
arch/powerpc/platforms/embedded6xx/wii.c:90:2: error: format ‘%llx’ expects argument of type ‘long long unsigned int’, but argument 2 has type ‘phys_addr_t’ [-Werror=format]
arch/powerpc/platforms/embedded6xx/wii.c:90:2: error: format ‘%llx’ expects argument of type ‘long long unsigned int’, but argument 3 has type ‘phys_addr_t’ [-Werror=format]
cc1: all warnings being treated as errors
make[2]: *** [arch/powerpc/platforms/embedded6xx/wii.o] Error 1
make[1]: *** [arch/powerpc/platforms/embedded6xx] Error 2
make: *** [arch/powerpc/platforms] Error 2

Signed-off-by: Shuah Khan <shuah.khan@hp.com>
CC: stable@vger.kernel.org 3.0.y
---
 arch/powerpc/platforms/embedded6xx/wii.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Ben Hutchings Dec. 8, 2012, 5:22 p.m. UTC | #1
On Fri, 2012-12-07 at 19:07 -0700, Shuah Khan wrote:
> Fix wii_memory_fixups() the following compile error on 3.0.y tree with 
> wii_defconfig on 3.0.y tree.
> 
>   CC      arch/powerpc/platforms/embedded6xx/wii.o
> arch/powerpc/platforms/embedded6xx/wii.c: In function ‘wii_memory_fixups’:
> arch/powerpc/platforms/embedded6xx/wii.c:88:2: error: format ‘%llx’ expects argument of type ‘long long unsigned int’, but argument 2 has type ‘phys_addr_t’ [-Werror=format]
> arch/powerpc/platforms/embedded6xx/wii.c:88:2: error: format ‘%llx’ expects argument of type ‘long long unsigned int’, but argument 3 has type ‘phys_addr_t’ [-Werror=format]
> arch/powerpc/platforms/embedded6xx/wii.c:90:2: error: format ‘%llx’ expects argument of type ‘long long unsigned int’, but argument 2 has type ‘phys_addr_t’ [-Werror=format]
> arch/powerpc/platforms/embedded6xx/wii.c:90:2: error: format ‘%llx’ expects argument of type ‘long long unsigned int’, but argument 3 has type ‘phys_addr_t’ [-Werror=format]
> cc1: all warnings being treated as errors
> make[2]: *** [arch/powerpc/platforms/embedded6xx/wii.o] Error 1
> make[1]: *** [arch/powerpc/platforms/embedded6xx] Error 2
> make: *** [arch/powerpc/platforms] Error 2
> 
> Signed-off-by: Shuah Khan <shuah.khan@hp.com>
> CC: stable@vger.kernel.org 3.0.y
> ---
>  arch/powerpc/platforms/embedded6xx/wii.c |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/powerpc/platforms/embedded6xx/wii.c b/arch/powerpc/platforms/embedded6xx/wii.c
> index 1b5dc1a..13d58dd 100644
> --- a/arch/powerpc/platforms/embedded6xx/wii.c
> +++ b/arch/powerpc/platforms/embedded6xx/wii.c
> @@ -85,9 +85,9 @@ void __init wii_memory_fixups(void)
>  	wii_hole_start = p[0].base + p[0].size;
>  	wii_hole_size = p[1].base - wii_hole_start;
>  
> -	pr_info("MEM1: <%08llx %08llx>\n", p[0].base, p[0].size);
> +	pr_info("MEM1: <%08ulx %08ulx>\n", p[0].base, p[0].size);

"%08ulx" is the conversion specification "%08u" followed by literal
"lx".  If phys_addr_t is always defined as unsigned long or always
unsigned int for this platform then you could use "%08lx" or "%08x"
respectively.  But usually the right thing to do is to cast the
arguments of type phys_addr_t to unsigned long long (or, equivalently,
u64).

Ben.

>  	pr_info("HOLE: <%08lx %08lx>\n", wii_hole_start, wii_hole_size);
> -	pr_info("MEM2: <%08llx %08llx>\n", p[1].base, p[1].size);
> +	pr_info("MEM2: <%08ulx %08ulx>\n", p[1].base, p[1].size);
>  
>  	p[0].size += wii_hole_size + p[1].size;
>
Shuah Khan Dec. 9, 2012, 1:21 a.m. UTC | #2
On Sat, Dec 8, 2012 at 10:22 AM, Ben Hutchings <ben@decadent.org.uk> wrote:
> On Fri, 2012-12-07 at 19:07 -0700, Shuah Khan wrote:
>> Fix wii_memory_fixups() the following compile error on 3.0.y tree with
>> wii_defconfig on 3.0.y tree.
>>
>>   CC      arch/powerpc/platforms/embedded6xx/wii.o
>> arch/powerpc/platforms/embedded6xx/wii.c: In function ‘wii_memory_fixups’:
>> arch/powerpc/platforms/embedded6xx/wii.c:88:2: error: format ‘%llx’ expects argument of type ‘long long unsigned int’, but argument 2 has type ‘phys_addr_t’ [-Werror=format]
>> arch/powerpc/platforms/embedded6xx/wii.c:88:2: error: format ‘%llx’ expects argument of type ‘long long unsigned int’, but argument 3 has type ‘phys_addr_t’ [-Werror=format]
>> arch/powerpc/platforms/embedded6xx/wii.c:90:2: error: format ‘%llx’ expects argument of type ‘long long unsigned int’, but argument 2 has type ‘phys_addr_t’ [-Werror=format]
>> arch/powerpc/platforms/embedded6xx/wii.c:90:2: error: format ‘%llx’ expects argument of type ‘long long unsigned int’, but argument 3 has type ‘phys_addr_t’ [-Werror=format]
>> cc1: all warnings being treated as errors
>> make[2]: *** [arch/powerpc/platforms/embedded6xx/wii.o] Error 1
>> make[1]: *** [arch/powerpc/platforms/embedded6xx] Error 2
>> make: *** [arch/powerpc/platforms] Error 2
>>
>> Signed-off-by: Shuah Khan <shuah.khan@hp.com>
>> CC: stable@vger.kernel.org 3.0.y
>> ---
>>  arch/powerpc/platforms/embedded6xx/wii.c |    4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/arch/powerpc/platforms/embedded6xx/wii.c b/arch/powerpc/platforms/embedded6xx/wii.c
>> index 1b5dc1a..13d58dd 100644
>> --- a/arch/powerpc/platforms/embedded6xx/wii.c
>> +++ b/arch/powerpc/platforms/embedded6xx/wii.c
>> @@ -85,9 +85,9 @@ void __init wii_memory_fixups(void)
>>       wii_hole_start = p[0].base + p[0].size;
>>       wii_hole_size = p[1].base - wii_hole_start;
>>
>> -     pr_info("MEM1: <%08llx %08llx>\n", p[0].base, p[0].size);
>> +     pr_info("MEM1: <%08ulx %08ulx>\n", p[0].base, p[0].size);
>
> "%08ulx" is the conversion specification "%08u" followed by literal
> "lx".  If phys_addr_t is always defined as unsigned long or always
> unsigned int for this platform then you could use "%08lx" or "%08x"
> respectively.  But usually the right thing to do is to cast the
> arguments of type phys_addr_t to unsigned long long (or, equivalently,
> u64).
>
> Ben.

Thanks. I should have gone with my first instinct of typecasting :)  Will
resend the patch with typecast instead of the change I made in a couple
of days.

Thanks,
-- Shuah
diff mbox

Patch

diff --git a/arch/powerpc/platforms/embedded6xx/wii.c b/arch/powerpc/platforms/embedded6xx/wii.c
index 1b5dc1a..13d58dd 100644
--- a/arch/powerpc/platforms/embedded6xx/wii.c
+++ b/arch/powerpc/platforms/embedded6xx/wii.c
@@ -85,9 +85,9 @@  void __init wii_memory_fixups(void)
 	wii_hole_start = p[0].base + p[0].size;
 	wii_hole_size = p[1].base - wii_hole_start;
 
-	pr_info("MEM1: <%08llx %08llx>\n", p[0].base, p[0].size);
+	pr_info("MEM1: <%08ulx %08ulx>\n", p[0].base, p[0].size);
 	pr_info("HOLE: <%08lx %08lx>\n", wii_hole_start, wii_hole_size);
-	pr_info("MEM2: <%08llx %08llx>\n", p[1].base, p[1].size);
+	pr_info("MEM2: <%08ulx %08ulx>\n", p[1].base, p[1].size);
 
 	p[0].size += wii_hole_size + p[1].size;