Subject: linux-next: build failure after merge of the akpm-current tree

From: Stephen Rothwell <[email-masked]>
Date: Fri, 1 May 2015 14:25:33 +1000

Hi Andrew,

After merging the akpm tree, today's linux-next build (sparc defconfig)
failed like this:

mm/bootmem.c: In function 'free_all_bootmem_core':
mm/bootmem.c:237:32: error: 'cur' undeclared (first use in this function)
   __free_pages_bootmem(page++, cur++, 0);
                                ^

Caused by commit "mm: page_alloc: pass PFN to __free_pages_bootmem".
This only happens because CONFIG_NO_BOOTMEM is *not* set (it is set on
powerpc, x86, arm and sparc64).  Clearly it was never built for this
config.  :-(

Reverting would be a real pain, so I added this (probably incorrect)
patch to make it build:

From: Stephen Rothwell <[email-masked]>
Date: Fri, 1 May 2015 14:21:08 +1000
Subject: [PATCH] mm: page_alloc: pass PFN to __free_pages_bootmem fix

Signed-off-by: Stephen Rothwell <[email-masked]>
---
 mm/bootmem.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/mm/bootmem.c b/mm/bootmem.c
index daf956bb4782..0a0eb62b1c92 100644
--- a/mm/bootmem.c
+++ b/mm/bootmem.c
@@ -173,6 +173,7 @@ static unsigned long __init free_all_bootmem_core(bootmem_data_t *bdata)
 {
 	struct page *page;
 	unsigned long *map, start, end, pages, count = 0;
+	unsigned long cur;
 
 	if (!bdata->node_bootmem_map)
 		return 0;
@@ -214,7 +215,7 @@ static unsigned long __init free_all_bootmem_core(bootmem_data_t *bdata)
 			count += BITS_PER_LONG;
 			start += BITS_PER_LONG;
 		} else {
-			unsigned long cur = start;
+			cur = start;
 
 			start = ALIGN(start + 1, BITS_PER_LONG);
 			while (vec && cur != start) {
@@ -233,6 +234,7 @@ static unsigned long __init free_all_bootmem_core(bootmem_data_t *bdata)
 	pages = bdata->node_low_pfn - bdata->node_min_pfn;
 	pages = bootmem_bootmap_pages(pages);
 	count += pages;
+	cur = bdata->node_min_pfn;
 	while (pages--)
 		__free_pages_bootmem(page++, cur++, 0);
 
-- 
2.1.4

-- 
Cheers,
Stephen Rothwell                    [email-masked]