powerpc: fix wii_memory_fixups() compile error on 3.0.y tree
PATCH 1/1 powerpc: fix wii_memory_fixups() compile error on 3.0.y tree
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.oarch/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
--- arch/powerpc/platforms/embedded6xx/wii.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/powerpc/platforms/embedded6xx/wii.c +2 -2
@@ -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;
Signature · 1 line
1.7.9.5
Quoted 25 lines · Shuah Khan
Fix
wii_memory_fixups()the following compile error on 3.0.y tree withwii_defconfigon 3.0.y tree.CC
arch/powerpc/platforms/embedded6xx/wii.oarch/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 2Signed-off-by Shuah Khan <[email protected]>CC [email protected] 3.0.y--- arch/powerpc/platforms/embedded6xx/wii.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)arch/powerpc/platforms/embedded6xx/wii.c +0
-0
arch/powerpc/platforms/embedded6xx/wii.c void __init wii_memory_fixups(void) · line 88
Quoted 5 lines
arch/powerpc/platforms/embedded6xx/wii.c +1
-1@@ -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.
Quoted 6 lines
arch/powerpc/platforms/embedded6xx/wii.c +1
-1pr_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;
Signature · 2 lines
Ben Hutchings Beware of programmers who carry screwdrivers. - Leonard Brandwein
Quoted 6 lines · Ben Hutchings
Quoted 5 lines · Shuah Khan
Fix
wii_memory_fixups()the following compile error on 3.0.y tree withwii_defconfigon 3.0.y tree.CC
arch/powerpc/platforms/embedded6xx/wii.oarch/powerpc/platforms/embedded6xx/wii.c: In function =91wii_memory_fixu=
ps=92:
Quoted 1 line
Quoted 1 line
arch/powerpc/platforms/embedded6xx/wii.c:88:2: error: format =91%llx=92 =
expects argument of type =91long long unsigned int=92, but argument 2 has t= ype =91phys_addr_t=92 [-Werror=3Dformat]
Quoted 1 line
Quoted 1 line
arch/powerpc/platforms/embedded6xx/wii.c:88:2: error: format =91%llx=92 =
expects argument of type =91long long unsigned int=92, but argument 3 has t= ype =91phys_addr_t=92 [-Werror=3Dformat]
Quoted 1 line
Quoted 1 line
arch/powerpc/platforms/embedded6xx/wii.c:90:2: error: format =91%llx=92 =
expects argument of type =91long long unsigned int=92, but argument 2 has t= ype =91phys_addr_t=92 [-Werror=3Dformat]
Quoted 1 line
Quoted 1 line
arch/powerpc/platforms/embedded6xx/wii.c:90:2: error: format =91%llx=92 =
expects argument of type =91long long unsigned int=92, but argument 3 has t= ype =91phys_addr_t=92 [-Werror=3Dformat]
Quoted 5 lines
Quoted 5 lines
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
Quoted 7 lines
arch/powerpc/pla=
Quoted 7 lines
Signed-off-by Shuah Khan <[email protected]>CC [email protected] 3.0.y--- arch/powerpc/platforms/embedded6xx/wii.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)arch/powerpc/pla= renamed from arch/powerpc/platforms/embedded6xx/wii.c +0
-0
tforms/embedded6xx/wii.c
Quoted 17 lines
arch/powerpc/platforms/embedded6xx/wii.c void __init wii_memory_fixups(void) · line 88
Quoted 9 lines
index 1b5dc1a..13d58dd 100644
arch/powerpc/platforms/embedded6xx/wii.c +1
-1@@ -85,9 +85,9 @@ void __init wii_memory_fixups(void) wii_hole_start =3D p[0].base + p[0].size; wii_hole_size =3D 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_tis 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 typephys_addr_tto unsigned long long (or, equivalently, u64).
Quoted 1 line
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
PATCH v2 1/1 powerpc: fix wii_memory_fixups() compile error on 3.0.y tree
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.oarch/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
--- arch/powerpc/platforms/embedded6xx/wii.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
arch/powerpc/platforms/embedded6xx/wii.c +4 -2
@@ -85,9 +85,11 @@ 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" , + (phys_addr_t ) p[0 ].base, (phys_addr_t ) 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" , + (phys_addr_t ) p[1 ].base, (phys_addr_t ) p[1 ].size); p[0 ].size += wii_hole_size + p[1 ].size;
Signature · 1 line
1.7.9.5
Quoted 25 lines · Shuah Khan
Fix
wii_memory_fixups()the following compile error on 3.0.y tree withwii_defconfigon 3.0.y tree.CC
arch/powerpc/platforms/embedded6xx/wii.oarch/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 2Signed-off-by Shuah Khan <[email protected]>CC [email protected] 3.0.y--- arch/powerpc/platforms/embedded6xx/wii.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)arch/powerpc/platforms/embedded6xx/wii.c +0
-0
arch/powerpc/platforms/embedded6xx/wii.c void __init wii_memory_fixups(void) · line 89
Quoted 6 lines
arch/powerpc/platforms/embedded6xx/wii.c +2
-1@@ -85,9 +85,11 @@ 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" , + (phys_addr_t ) p[0 ].base, (phys_addr_t ) p[0 ].size);
[...]
This is incorrect in exactly the same way as the last version, but with extra redundant casts.
Ben.
Signature · 3 lines
Ben Hutchings
We get into the habit of living before acquiring the habit of thinking.
- Albert CamusQuoted 29 lines · Ben Hutchings
Quoted 28 lines · Shuah Khan
Fix
wii_memory_fixups()the following compile error on 3.0.y tree withwii_defconfigon 3.0.y tree.CC
arch/powerpc/platforms/embedded6xx/wii.oarch/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 2Signed-off-by Shuah Khan <[email protected]>CC [email protected] 3.0.y--- arch/powerpc/platforms/embedded6xx/wii.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)arch/powerpc/platforms/embedded6xx/wii.c +0
-0@@ -85,9 +85,11 @@ void __init wii_memory_fixups(void) wii_hole_start = p[0 ].base + p[0 ].size; wii_hole_size = p[1 ].base - wii_hole_start;
Quoted 8 lines
arch/powerpc/platforms/embedded6xx/wii.c void __init wii_memory_fixups(void) · line 89
Quoted 3 lines
arch/powerpc/platforms/embedded6xx/wii.c +2
-1-pr_info ("MEM1: <%08llx %08llx>\n" , p[0 ].base, p[0 ].size); +pr_info ("MEM1: <%08ulx %08ulx>\n" , + (phys_addr_t ) p[0 ].base, (phys_addr_t ) p[0 ].size);[...]
This is incorrect in exactly the same way as the last version, but with extra redundant casts.
Yes it is. :) That is embarrassing. The lesson is "don't try to work when not feeling well", at least that is my excuse.
Thanks for catching it. I will really fix it this time and send a new patch. This bug is in there since Dec 2009, not sure if this is worth fixing, but might as well.
de32400dd26e743c5d500aa42d8d6818b79edb73
wii: use both mem1 and mem2 as ram
-- Shuah
PATCH v3 1/1 powerpc: fix wii_memory_fixups() compile error on 3.0.y tree
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.oarch/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
--- arch/powerpc/platforms/embedded6xx/wii.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
arch/powerpc/platforms/embedded6xx/wii.c +4 -2
@@ -85,9 +85,11 @@ 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: <%08llx %08llx>\n" , + (unsigned long long ) p[0 ].base, (unsigned long long ) 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: <%08llx %08llx>\n" , + (unsigned long long ) p[1 ].base, (unsigned long long ) p[1 ].size); p[0 ].size += wii_hole_size + p[1 ].size;
Signature · 1 line
1.7.9.5
Quoted 14 lines · Shuah Khan
Fix
wii_memory_fixups()the following compile error on 3.0.y tree withwii_defconfigon 3.0.y tree.CC
arch/powerpc/platforms/embedded6xx/wii.oarch/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
Quoted 2 lines
Signed-off-by Shuah Khan <[email protected]>CC [email protected] 3.0.y
[...]
This looks fine, and I've queued it up for 3.2 since the errant code wasn't removed until 3.3.
Ben.
Signature · 3 lines
Ben Hutchings
Theory and practice are closer in theory than in practice.
- John Levine, moderator of comp.compilers