aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJiang Liu <liuj97@gmail.com>2013-07-03 18:02:48 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2013-07-03 19:07:32 -0400
commit11199692d83dd3fe1511203024fb9853d176ec4c (patch)
treea8632c310774eef2928f24d5aca81d1203dd54b8
parentdcf6b7ddd7df8965727746f89c59229b23180e5a (diff)
mm: change signature of free_reserved_area() to fix building warnings
Change signature of free_reserved_area() according to Russell King's suggestion to fix following build warnings: arch/arm/mm/init.c: In function 'mem_init': arch/arm/mm/init.c:603:2: warning: passing argument 1 of 'free_reserved_area' makes integer from pointer without a cast [enabled by default] free_reserved_area(__va(PHYS_PFN_OFFSET), swapper_pg_dir, 0, NULL); ^ In file included from include/linux/mman.h:4:0, from arch/arm/mm/init.c:15: include/linux/mm.h:1301:22: note: expected 'long unsigned int' but argument is of type 'void *' extern unsigned long free_reserved_area(unsigned long start, unsigned long end, mm/page_alloc.c: In function 'free_reserved_area': >> mm/page_alloc.c:5134:3: warning: passing argument 1 of 'virt_to_phys' makes pointer from integer without a cast [enabled by default] In file included from arch/mips/include/asm/page.h:49:0, from include/linux/mmzone.h:20, from include/linux/gfp.h:4, from include/linux/mm.h:8, from mm/page_alloc.c:18: arch/mips/include/asm/io.h:119:29: note: expected 'const volatile void *' but argument is of type 'long unsigned int' mm/page_alloc.c: In function 'free_area_init_nodes': mm/page_alloc.c:5030:34: warning: array subscript is below array bounds [-Warray-bounds] Also address some minor code review comments. Signed-off-by: Jiang Liu <jiang.liu@huawei.com> Reported-by: Arnd Bergmann <arnd@arndb.de> Cc: "H. Peter Anvin" <hpa@zytor.com> Cc: "Michael S. Tsirkin" <mst@redhat.com> Cc: <sworddragon2@aol.com> Cc: Catalin Marinas <catalin.marinas@arm.com> Cc: Chris Metcalf <cmetcalf@tilera.com> Cc: David Howells <dhowells@redhat.com> Cc: Geert Uytterhoeven <geert@linux-m68k.org> Cc: Ingo Molnar <mingo@redhat.com> Cc: Jeremy Fitzhardinge <jeremy@goop.org> Cc: Jianguo Wu <wujianguo@huawei.com> Cc: Joonsoo Kim <js1304@gmail.com> Cc: Kamezawa Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> Cc: Marek Szyprowski <m.szyprowski@samsung.com> Cc: Mel Gorman <mel@csn.ul.ie> Cc: Michel Lespinasse <walken@google.com> Cc: Minchan Kim <minchan@kernel.org> Cc: Rik van Riel <riel@redhat.com> Cc: Rusty Russell <rusty@rustcorp.com.au> Cc: Tang Chen <tangchen@cn.fujitsu.com> Cc: Tejun Heo <tj@kernel.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Wen Congyang <wency@cn.fujitsu.com> Cc: Will Deacon <will.deacon@arm.com> Cc: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com> Cc: Yinghai Lu <yinghai@kernel.org> Cc: Russell King <rmk@arm.linux.org.uk> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--arch/alpha/kernel/sys_nautilus.c4
-rw-r--r--arch/alpha/mm/init.c2
-rw-r--r--arch/arc/mm/init.c2
-rw-r--r--arch/arm/mm/init.c2
-rw-r--r--arch/arm64/mm/init.c2
-rw-r--r--arch/avr32/mm/init.c2
-rw-r--r--arch/blackfin/mm/init.c2
-rw-r--r--arch/c6x/mm/init.c2
-rw-r--r--arch/frv/mm/init.c2
-rw-r--r--arch/h8300/mm/init.c2
-rw-r--r--arch/ia64/mm/init.c3
-rw-r--r--arch/m32r/mm/init.c2
-rw-r--r--arch/m68k/mm/init.c2
-rw-r--r--arch/metag/mm/init.c3
-rw-r--r--arch/microblaze/mm/init.c2
-rw-r--r--arch/mips/mm/init.c3
-rw-r--r--arch/mn10300/mm/init.c3
-rw-r--r--arch/openrisc/mm/init.c2
-rw-r--r--arch/parisc/mm/init.c3
-rw-r--r--arch/powerpc/kernel/kvm.c2
-rw-r--r--arch/powerpc/mm/mem.c2
-rw-r--r--arch/s390/mm/init.c3
-rw-r--r--arch/score/mm/init.c3
-rw-r--r--arch/sh/mm/init.c2
-rw-r--r--arch/sparc/mm/init_32.c4
-rw-r--r--arch/sparc/mm/init_64.c4
-rw-r--r--arch/um/kernel/mem.c2
-rw-r--r--arch/unicore32/mm/init.c2
-rw-r--r--arch/xtensa/mm/init.c2
-rw-r--r--include/linux/mm.h5
-rw-r--r--mm/page_alloc.c19
31 files changed, 50 insertions, 45 deletions
diff --git a/arch/alpha/kernel/sys_nautilus.c b/arch/alpha/kernel/sys_nautilus.c
index 1d4aabfcf9a1..891bd274ccb5 100644
--- a/arch/alpha/kernel/sys_nautilus.c
+++ b/arch/alpha/kernel/sys_nautilus.c
@@ -238,8 +238,8 @@ nautilus_init_pci(void)
238 if (pci_mem < memtop) 238 if (pci_mem < memtop)
239 memtop = pci_mem; 239 memtop = pci_mem;
240 if (memtop > alpha_mv.min_mem_address) { 240 if (memtop > alpha_mv.min_mem_address) {
241 free_reserved_area((unsigned long)__va(alpha_mv.min_mem_address), 241 free_reserved_area(__va(alpha_mv.min_mem_address),
242 (unsigned long)__va(memtop), 0, NULL); 242 __va(memtop), 0, NULL);
243 printk("nautilus_init_pci: %ldk freed\n", 243 printk("nautilus_init_pci: %ldk freed\n",
244 (memtop - alpha_mv.min_mem_address) >> 10); 244 (memtop - alpha_mv.min_mem_address) >> 10);
245 } 245 }
diff --git a/arch/alpha/mm/init.c b/arch/alpha/mm/init.c
index 0ba85ee4a466..d54848d4e464 100644
--- a/arch/alpha/mm/init.c
+++ b/arch/alpha/mm/init.c
@@ -326,6 +326,6 @@ free_initmem(void)
326void 326void
327free_initrd_mem(unsigned long start, unsigned long end) 327free_initrd_mem(unsigned long start, unsigned long end)
328{ 328{
329 free_reserved_area(start, end, 0, "initrd"); 329 free_reserved_area((void *)start, (void *)end, 0, "initrd");
330} 330}
331#endif 331#endif
diff --git a/arch/arc/mm/init.c b/arch/arc/mm/init.c
index 4a177365b2c4..dce02e4716a1 100644
--- a/arch/arc/mm/init.c
+++ b/arch/arc/mm/init.c
@@ -152,7 +152,7 @@ void __init_refok free_initmem(void)
152#ifdef CONFIG_BLK_DEV_INITRD 152#ifdef CONFIG_BLK_DEV_INITRD
153void __init free_initrd_mem(unsigned long start, unsigned long end) 153void __init free_initrd_mem(unsigned long start, unsigned long end)
154{ 154{
155 free_reserved_area(start, end, 0, "initrd"); 155 free_reserved_area((void *)start, (void *)end, 0, "initrd");
156} 156}
157#endif 157#endif
158 158
diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c
index 2ffee02d1d5c..7fae391caf86 100644
--- a/arch/arm/mm/init.c
+++ b/arch/arm/mm/init.c
@@ -745,7 +745,7 @@ void free_initrd_mem(unsigned long start, unsigned long end)
745{ 745{
746 if (!keep_initrd) { 746 if (!keep_initrd) {
747 poison_init_mem((void *)start, PAGE_ALIGN(end) - start); 747 poison_init_mem((void *)start, PAGE_ALIGN(end) - start);
748 free_reserved_area(start, end, 0, "initrd"); 748 free_reserved_area((void *)start, (void *)end, 0, "initrd");
749 } 749 }
750} 750}
751 751
diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c
index f497ca77925a..6041e4008a83 100644
--- a/arch/arm64/mm/init.c
+++ b/arch/arm64/mm/init.c
@@ -398,7 +398,7 @@ void free_initrd_mem(unsigned long start, unsigned long end)
398{ 398{
399 if (!keep_initrd) { 399 if (!keep_initrd) {
400 poison_init_mem((void *)start, PAGE_ALIGN(end) - start); 400 poison_init_mem((void *)start, PAGE_ALIGN(end) - start);
401 free_reserved_area(start, end, 0, "initrd"); 401 free_reserved_area((void *)start, (void *)end, 0, "initrd");
402 } 402 }
403} 403}
404 404
diff --git a/arch/avr32/mm/init.c b/arch/avr32/mm/init.c
index e66e8406f992..5a79fa08cb3c 100644
--- a/arch/avr32/mm/init.c
+++ b/arch/avr32/mm/init.c
@@ -154,6 +154,6 @@ void free_initmem(void)
154#ifdef CONFIG_BLK_DEV_INITRD 154#ifdef CONFIG_BLK_DEV_INITRD
155void free_initrd_mem(unsigned long start, unsigned long end) 155void free_initrd_mem(unsigned long start, unsigned long end)
156{ 156{
157 free_reserved_area(start, end, 0, "initrd"); 157 free_reserved_area((void *)start, (void *)end, 0, "initrd");
158} 158}
159#endif 159#endif
diff --git a/arch/blackfin/mm/init.c b/arch/blackfin/mm/init.c
index 82d01a71207f..8e9eab272811 100644
--- a/arch/blackfin/mm/init.c
+++ b/arch/blackfin/mm/init.c
@@ -133,7 +133,7 @@ void __init mem_init(void)
133void __init free_initrd_mem(unsigned long start, unsigned long end) 133void __init free_initrd_mem(unsigned long start, unsigned long end)
134{ 134{
135#ifndef CONFIG_MPU 135#ifndef CONFIG_MPU
136 free_reserved_area(start, end, 0, "initrd"); 136 free_reserved_area((void *)start, (void *)end, 0, "initrd");
137#endif 137#endif
138} 138}
139#endif 139#endif
diff --git a/arch/c6x/mm/init.c b/arch/c6x/mm/init.c
index b74ccb5a7690..07bfcc98a3b7 100644
--- a/arch/c6x/mm/init.c
+++ b/arch/c6x/mm/init.c
@@ -78,7 +78,7 @@ void __init mem_init(void)
78#ifdef CONFIG_BLK_DEV_INITRD 78#ifdef CONFIG_BLK_DEV_INITRD
79void __init free_initrd_mem(unsigned long start, unsigned long end) 79void __init free_initrd_mem(unsigned long start, unsigned long end)
80{ 80{
81 free_reserved_area(start, end, 0, "initrd"); 81 free_reserved_area((void *)start, (void *)end, 0, "initrd");
82} 82}
83#endif 83#endif
84 84
diff --git a/arch/frv/mm/init.c b/arch/frv/mm/init.c
index dee354fa6b64..a67f3a5897b8 100644
--- a/arch/frv/mm/init.c
+++ b/arch/frv/mm/init.c
@@ -173,6 +173,6 @@ void free_initmem(void)
173#ifdef CONFIG_BLK_DEV_INITRD 173#ifdef CONFIG_BLK_DEV_INITRD
174void __init free_initrd_mem(unsigned long start, unsigned long end) 174void __init free_initrd_mem(unsigned long start, unsigned long end)
175{ 175{
176 free_reserved_area(start, end, 0, "initrd"); 176 free_reserved_area((void *)start, (void *)end, 0, "initrd");
177} /* end free_initrd_mem() */ 177} /* end free_initrd_mem() */
178#endif 178#endif
diff --git a/arch/h8300/mm/init.c b/arch/h8300/mm/init.c
index ff349d70a29b..57e03c59861d 100644
--- a/arch/h8300/mm/init.c
+++ b/arch/h8300/mm/init.c
@@ -161,7 +161,7 @@ void __init mem_init(void)
161#ifdef CONFIG_BLK_DEV_INITRD 161#ifdef CONFIG_BLK_DEV_INITRD
162void free_initrd_mem(unsigned long start, unsigned long end) 162void free_initrd_mem(unsigned long start, unsigned long end)
163{ 163{
164 free_reserved_area(start, end, 0, "initrd"); 164 free_reserved_area((void *)start, (void *)end, 0, "initrd");
165} 165}
166#endif 166#endif
167 167
diff --git a/arch/ia64/mm/init.c b/arch/ia64/mm/init.c
index d1fe4b402601..da568c2e839f 100644
--- a/arch/ia64/mm/init.c
+++ b/arch/ia64/mm/init.c
@@ -154,8 +154,7 @@ ia64_init_addr_space (void)
154void 154void
155free_initmem (void) 155free_initmem (void)
156{ 156{
157 free_reserved_area((unsigned long)ia64_imva(__init_begin), 157 free_reserved_area(ia64_imva(__init_begin), ia64_imva(__init_end),
158 (unsigned long)ia64_imva(__init_end),
159 0, "unused kernel"); 158 0, "unused kernel");
160} 159}
161 160
diff --git a/arch/m32r/mm/init.c b/arch/m32r/mm/init.c
index ab4cbce91a9b..d80412d0c14e 100644
--- a/arch/m32r/mm/init.c
+++ b/arch/m32r/mm/init.c
@@ -191,6 +191,6 @@ void free_initmem(void)
191 *======================================================================*/ 191 *======================================================================*/
192void free_initrd_mem(unsigned long start, unsigned long end) 192void free_initrd_mem(unsigned long start, unsigned long end)
193{ 193{
194 free_reserved_area(start, end, 0, "initrd"); 194 free_reserved_area((void *)start, (void *)end, 0, "initrd");
195} 195}
196#endif 196#endif
diff --git a/arch/m68k/mm/init.c b/arch/m68k/mm/init.c
index 1af2ca3411f6..95de725534e9 100644
--- a/arch/m68k/mm/init.c
+++ b/arch/m68k/mm/init.c
@@ -202,6 +202,6 @@ void __init mem_init(void)
202#ifdef CONFIG_BLK_DEV_INITRD 202#ifdef CONFIG_BLK_DEV_INITRD
203void free_initrd_mem(unsigned long start, unsigned long end) 203void free_initrd_mem(unsigned long start, unsigned long end)
204{ 204{
205 free_reserved_area(start, end, 0, "initrd"); 205 free_reserved_area((void *)start, (void *)end, 0, "initrd");
206} 206}
207#endif 207#endif
diff --git a/arch/metag/mm/init.c b/arch/metag/mm/init.c
index d05b8455c44c..5e2238dd72e0 100644
--- a/arch/metag/mm/init.c
+++ b/arch/metag/mm/init.c
@@ -414,7 +414,8 @@ void free_initmem(void)
414#ifdef CONFIG_BLK_DEV_INITRD 414#ifdef CONFIG_BLK_DEV_INITRD
415void free_initrd_mem(unsigned long start, unsigned long end) 415void free_initrd_mem(unsigned long start, unsigned long end)
416{ 416{
417 free_reserved_area(start, end, POISON_FREE_INITMEM, "initrd"); 417 free_reserved_area((void *)start, (void *)end, POISON_FREE_INITMEM,
418 "initrd");
418} 419}
419#endif 420#endif
420 421
diff --git a/arch/microblaze/mm/init.c b/arch/microblaze/mm/init.c
index b38ae3acfeb4..d7b8ada9345f 100644
--- a/arch/microblaze/mm/init.c
+++ b/arch/microblaze/mm/init.c
@@ -235,7 +235,7 @@ void __init setup_memory(void)
235#ifdef CONFIG_BLK_DEV_INITRD 235#ifdef CONFIG_BLK_DEV_INITRD
236void free_initrd_mem(unsigned long start, unsigned long end) 236void free_initrd_mem(unsigned long start, unsigned long end)
237{ 237{
238 free_reserved_area(start, end, 0, "initrd"); 238 free_reserved_area((void *)start, (void *)end, 0, "initrd");
239} 239}
240#endif 240#endif
241 241
diff --git a/arch/mips/mm/init.c b/arch/mips/mm/init.c
index 9b973e0af9cb..268f2a94031b 100644
--- a/arch/mips/mm/init.c
+++ b/arch/mips/mm/init.c
@@ -440,7 +440,8 @@ void free_init_pages(const char *what, unsigned long begin, unsigned long end)
440#ifdef CONFIG_BLK_DEV_INITRD 440#ifdef CONFIG_BLK_DEV_INITRD
441void free_initrd_mem(unsigned long start, unsigned long end) 441void free_initrd_mem(unsigned long start, unsigned long end)
442{ 442{
443 free_reserved_area(start, end, POISON_FREE_INITMEM, "initrd"); 443 free_reserved_area((void *)start, (void *)end, POISON_FREE_INITMEM,
444 "initrd");
444} 445}
445#endif 446#endif
446 447
diff --git a/arch/mn10300/mm/init.c b/arch/mn10300/mm/init.c
index 5a8ace63a6b4..e19049d1f2b9 100644
--- a/arch/mn10300/mm/init.c
+++ b/arch/mn10300/mm/init.c
@@ -152,6 +152,7 @@ void free_initmem(void)
152#ifdef CONFIG_BLK_DEV_INITRD 152#ifdef CONFIG_BLK_DEV_INITRD
153void free_initrd_mem(unsigned long start, unsigned long end) 153void free_initrd_mem(unsigned long start, unsigned long end)
154{ 154{
155 free_reserved_area(start, end, POISON_FREE_INITMEM, "initrd"); 155 free_reserved_area((void *)start, (void *)end, POISON_FREE_INITMEM,
156 "initrd");
156} 157}
157#endif 158#endif
diff --git a/arch/openrisc/mm/init.c b/arch/openrisc/mm/init.c
index b3cbc6703837..ab113325dc4c 100644
--- a/arch/openrisc/mm/init.c
+++ b/arch/openrisc/mm/init.c
@@ -261,7 +261,7 @@ void __init mem_init(void)
261#ifdef CONFIG_BLK_DEV_INITRD 261#ifdef CONFIG_BLK_DEV_INITRD
262void free_initrd_mem(unsigned long start, unsigned long end) 262void free_initrd_mem(unsigned long start, unsigned long end)
263{ 263{
264 free_reserved_area(start, end, 0, "initrd"); 264 free_reserved_area((void *)start, (void *)end, 0, "initrd");
265} 265}
266#endif 266#endif
267 267
diff --git a/arch/parisc/mm/init.c b/arch/parisc/mm/init.c
index 505b56c6b9b9..3223d5e4a372 100644
--- a/arch/parisc/mm/init.c
+++ b/arch/parisc/mm/init.c
@@ -1101,6 +1101,7 @@ void flush_tlb_all(void)
1101#ifdef CONFIG_BLK_DEV_INITRD 1101#ifdef CONFIG_BLK_DEV_INITRD
1102void free_initrd_mem(unsigned long start, unsigned long end) 1102void free_initrd_mem(unsigned long start, unsigned long end)
1103{ 1103{
1104 num_physpages += free_reserved_area(start, end, 0, "initrd"); 1104 num_physpages += free_reserved_area((void *)start, (void *)end, 0,
1105 "initrd");
1105} 1106}
1106#endif 1107#endif
diff --git a/arch/powerpc/kernel/kvm.c b/arch/powerpc/kernel/kvm.c
index 6782221d49bd..5e4830a33c08 100644
--- a/arch/powerpc/kernel/kvm.c
+++ b/arch/powerpc/kernel/kvm.c
@@ -756,7 +756,7 @@ static __init void kvm_free_tmp(void)
756 end = (ulong)&kvm_tmp[ARRAY_SIZE(kvm_tmp)] & PAGE_MASK; 756 end = (ulong)&kvm_tmp[ARRAY_SIZE(kvm_tmp)] & PAGE_MASK;
757 757
758 /* Free the tmp space we don't need */ 758 /* Free the tmp space we don't need */
759 free_reserved_area(start, end, 0, NULL); 759 free_reserved_area((void *)start, (void *)end, 0, NULL);
760} 760}
761 761
762static int __init kvm_guest_init(void) 762static int __init kvm_guest_init(void)
diff --git a/arch/powerpc/mm/mem.c b/arch/powerpc/mm/mem.c
index 0988a26e0413..347c5b1bbd62 100644
--- a/arch/powerpc/mm/mem.c
+++ b/arch/powerpc/mm/mem.c
@@ -407,7 +407,7 @@ void free_initmem(void)
407#ifdef CONFIG_BLK_DEV_INITRD 407#ifdef CONFIG_BLK_DEV_INITRD
408void __init free_initrd_mem(unsigned long start, unsigned long end) 408void __init free_initrd_mem(unsigned long start, unsigned long end)
409{ 409{
410 free_reserved_area(start, end, 0, "initrd"); 410 free_reserved_area((void *)start, (void *)end, 0, "initrd");
411} 411}
412#endif 412#endif
413 413
diff --git a/arch/s390/mm/init.c b/arch/s390/mm/init.c
index 89ebae4008f2..0878c89fe7d2 100644
--- a/arch/s390/mm/init.c
+++ b/arch/s390/mm/init.c
@@ -172,7 +172,8 @@ void free_initmem(void)
172#ifdef CONFIG_BLK_DEV_INITRD 172#ifdef CONFIG_BLK_DEV_INITRD
173void __init free_initrd_mem(unsigned long start, unsigned long end) 173void __init free_initrd_mem(unsigned long start, unsigned long end)
174{ 174{
175 free_reserved_area(start, end, POISON_FREE_INITMEM, "initrd"); 175 free_reserved_area((void *)start, (void *)end, POISON_FREE_INITMEM,
176 "initrd");
176} 177}
177#endif 178#endif
178 179
diff --git a/arch/score/mm/init.c b/arch/score/mm/init.c
index 0940682ab38b..f5dd61eb4544 100644
--- a/arch/score/mm/init.c
+++ b/arch/score/mm/init.c
@@ -108,7 +108,8 @@ void __init mem_init(void)
108#ifdef CONFIG_BLK_DEV_INITRD 108#ifdef CONFIG_BLK_DEV_INITRD
109void free_initrd_mem(unsigned long start, unsigned long end) 109void free_initrd_mem(unsigned long start, unsigned long end)
110{ 110{
111 free_reserved_area(start, end, POISON_FREE_INITMEM, "initrd"); 111 free_reserved_area((void *)start, (void *)end, POISON_FREE_INITMEM,
112 "initrd");
112} 113}
113#endif 114#endif
114 115
diff --git a/arch/sh/mm/init.c b/arch/sh/mm/init.c
index 20f9ead650d3..b892a9b7d7e3 100644
--- a/arch/sh/mm/init.c
+++ b/arch/sh/mm/init.c
@@ -505,7 +505,7 @@ void free_initmem(void)
505#ifdef CONFIG_BLK_DEV_INITRD 505#ifdef CONFIG_BLK_DEV_INITRD
506void free_initrd_mem(unsigned long start, unsigned long end) 506void free_initrd_mem(unsigned long start, unsigned long end)
507{ 507{
508 free_reserved_area(start, end, 0, "initrd"); 508 free_reserved_area((void *)start, (void *)end, 0, "initrd");
509} 509}
510#endif 510#endif
511 511
diff --git a/arch/sparc/mm/init_32.c b/arch/sparc/mm/init_32.c
index af472cf7c69a..d5f9c023826f 100644
--- a/arch/sparc/mm/init_32.c
+++ b/arch/sparc/mm/init_32.c
@@ -372,8 +372,8 @@ void free_initmem (void)
372#ifdef CONFIG_BLK_DEV_INITRD 372#ifdef CONFIG_BLK_DEV_INITRD
373void free_initrd_mem(unsigned long start, unsigned long end) 373void free_initrd_mem(unsigned long start, unsigned long end)
374{ 374{
375 num_physpages += free_reserved_area(start, end, POISON_FREE_INITMEM, 375 num_physpages += free_reserved_area((void *)start, (void *)end,
376 "initrd"); 376 POISON_FREE_INITMEM, "initrd");
377} 377}
378#endif 378#endif
379 379
diff --git a/arch/sparc/mm/init_64.c b/arch/sparc/mm/init_64.c
index 04fd55a6e461..8269deb84eda 100644
--- a/arch/sparc/mm/init_64.c
+++ b/arch/sparc/mm/init_64.c
@@ -2131,8 +2131,8 @@ void free_initmem(void)
2131#ifdef CONFIG_BLK_DEV_INITRD 2131#ifdef CONFIG_BLK_DEV_INITRD
2132void free_initrd_mem(unsigned long start, unsigned long end) 2132void free_initrd_mem(unsigned long start, unsigned long end)
2133{ 2133{
2134 num_physpages += free_reserved_area(start, end, POISON_FREE_INITMEM, 2134 num_physpages += free_reserved_area((void *)start, (void *)end,
2135 "initrd"); 2135 POISON_FREE_INITMEM, "initrd");
2136} 2136}
2137#endif 2137#endif
2138 2138
diff --git a/arch/um/kernel/mem.c b/arch/um/kernel/mem.c
index 9df292b270a8..2aa7a2448d58 100644
--- a/arch/um/kernel/mem.c
+++ b/arch/um/kernel/mem.c
@@ -244,7 +244,7 @@ void free_initmem(void)
244#ifdef CONFIG_BLK_DEV_INITRD 244#ifdef CONFIG_BLK_DEV_INITRD
245void free_initrd_mem(unsigned long start, unsigned long end) 245void free_initrd_mem(unsigned long start, unsigned long end)
246{ 246{
247 free_reserved_area(start, end, 0, "initrd"); 247 free_reserved_area((void *)start, (void *)end, 0, "initrd");
248} 248}
249#endif 249#endif
250 250
diff --git a/arch/unicore32/mm/init.c b/arch/unicore32/mm/init.c
index 63df12d71ce3..220755cc9700 100644
--- a/arch/unicore32/mm/init.c
+++ b/arch/unicore32/mm/init.c
@@ -486,7 +486,7 @@ static int keep_initrd;
486void free_initrd_mem(unsigned long start, unsigned long end) 486void free_initrd_mem(unsigned long start, unsigned long end)
487{ 487{
488 if (!keep_initrd) 488 if (!keep_initrd)
489 free_reserved_area(start, end, 0, "initrd"); 489 free_reserved_area((void *)start, (void *)end, 0, "initrd");
490} 490}
491 491
492static int __init keepinitrd_setup(char *__unused) 492static int __init keepinitrd_setup(char *__unused)
diff --git a/arch/xtensa/mm/init.c b/arch/xtensa/mm/init.c
index bba125b4bb06..4d658efc3289 100644
--- a/arch/xtensa/mm/init.c
+++ b/arch/xtensa/mm/init.c
@@ -214,7 +214,7 @@ extern int initrd_is_mapped;
214void free_initrd_mem(unsigned long start, unsigned long end) 214void free_initrd_mem(unsigned long start, unsigned long end)
215{ 215{
216 if (initrd_is_mapped) 216 if (initrd_is_mapped)
217 free_reserved_area(start, end, 0, "initrd"); 217 free_reserved_area((void *)start, (void *)end, 0, "initrd");
218} 218}
219#endif 219#endif
220 220
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 949bd7035895..be1b96ce0650 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -1311,7 +1311,7 @@ extern void free_initmem(void);
1311 * "poison" if it's non-zero. 1311 * "poison" if it's non-zero.
1312 * Return pages freed into the buddy system. 1312 * Return pages freed into the buddy system.
1313 */ 1313 */
1314extern unsigned long free_reserved_area(unsigned long start, unsigned long end, 1314extern unsigned long free_reserved_area(void *start, void *end,
1315 int poison, char *s); 1315 int poison, char *s);
1316#ifdef CONFIG_HIGHMEM 1316#ifdef CONFIG_HIGHMEM
1317/* 1317/*
@@ -1355,8 +1355,7 @@ static inline unsigned long free_initmem_default(int poison)
1355{ 1355{
1356 extern char __init_begin[], __init_end[]; 1356 extern char __init_begin[], __init_end[];
1357 1357
1358 return free_reserved_area(PAGE_ALIGN((unsigned long)&__init_begin) , 1358 return free_reserved_area(&__init_begin, &__init_end,
1359 ((unsigned long)&__init_end) & PAGE_MASK,
1360 poison, "unused kernel"); 1359 poison, "unused kernel");
1361} 1360}
1362 1361
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index d711dcdda362..be18ccd017bb 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -5206,25 +5206,26 @@ early_param("movablecore", cmdline_parse_movablecore);
5206 5206
5207#endif /* CONFIG_HAVE_MEMBLOCK_NODE_MAP */ 5207#endif /* CONFIG_HAVE_MEMBLOCK_NODE_MAP */
5208 5208
5209unsigned long free_reserved_area(unsigned long start, unsigned long end, 5209unsigned long free_reserved_area(void *start, void *end, int poison, char *s)
5210 int poison, char *s)
5211{ 5210{
5212 unsigned long pages, pos; 5211 void *pos;
5212 unsigned long pages = 0;
5213 5213
5214 pos = start = PAGE_ALIGN(start); 5214 start = (void *)PAGE_ALIGN((unsigned long)start);
5215 end &= PAGE_MASK; 5215 end = (void *)((unsigned long)end & PAGE_MASK);
5216 for (pages = 0; pos < end; pos += PAGE_SIZE, pages++) { 5216 for (pos = start; pos < end; pos += PAGE_SIZE, pages++) {
5217 if (poison) 5217 if (poison)
5218 memset((void *)pos, poison, PAGE_SIZE); 5218 memset(pos, poison, PAGE_SIZE);
5219 free_reserved_page(virt_to_page((void *)pos)); 5219 free_reserved_page(virt_to_page(pos));
5220 } 5220 }
5221 5221
5222 if (pages && s) 5222 if (pages && s)
5223 pr_info("Freeing %s memory: %ldK (%lx - %lx)\n", 5223 pr_info("Freeing %s memory: %ldK (%p - %p)\n",
5224 s, pages << (PAGE_SHIFT - 10), start, end); 5224 s, pages << (PAGE_SHIFT - 10), start, end);
5225 5225
5226 return pages; 5226 return pages;
5227} 5227}
5228EXPORT_SYMBOL(free_reserved_area);
5228 5229
5229#ifdef CONFIG_HIGHMEM 5230#ifdef CONFIG_HIGHMEM
5230void free_highmem_page(struct page *page) 5231void free_highmem_page(struct page *page)