Re: 2.6.26-rc7: x86 build error

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Adrian Bunk <bunk@...>
Cc: Linus Torvalds <torvalds@...>, Bernhard Walle <bwalle@...>, Ingo Molnar <mingo@...>, Linux Kernel Mailing List <linux-kernel@...>, <stable@...>
Date: Saturday, June 21, 2008 - 1:01 pm

Hi,

Adrian Bunk <bunk@kernel.org> writes:


Yes, this triggers it since reserve_bootmem() is then defined to be
reserve_bootmem_node() which returns void while the
!CONFIG_HAVE_ARCH_BOOTMEM_NODE version of reserve_bootmem() in bootmem.c
already returns int.

The following fix is needed:

---

From: Bernhard Walle <bwalle@suse.de>
Subject: Add return value to reserve_bootmem_node()

This patch changes the function reserve_bootmem_node() from void to int,
returning -ENOMEM if the allocation fails.


Signed-off-by: Bernhard Walle <bwalle@suse.de>;

---

Actually, there was a discussion to return -EBUSY instead of -ENOMEM but
in the end it does not matter, because callsites just check for negative
return values.  -hannes

 include/linux/bootmem.h |    2 +-
 mm/bootmem.c            |    6 ++++--
 2 files changed, 5 insertions(+), 3 deletions(-)
--- a/include/linux/bootmem.h
+++ b/include/linux/bootmem.h
@@ -94,7 +94,7 @@ extern unsigned long init_bootmem_node(p
 				       unsigned long freepfn,
 				       unsigned long startpfn,
 				       unsigned long endpfn);
-extern void reserve_bootmem_node(pg_data_t *pgdat,
+extern int reserve_bootmem_node(pg_data_t *pgdat,
 				 unsigned long physaddr,
 				 unsigned long size,
 				 int flags);
--- a/mm/bootmem.c
+++ b/mm/bootmem.c
@@ -442,15 +442,17 @@ unsigned long __init init_bootmem_node(p
 	return init_bootmem_core(pgdat, freepfn, startpfn, endpfn);
 }
 
-void __init reserve_bootmem_node(pg_data_t *pgdat, unsigned long physaddr,
+int __init reserve_bootmem_node(pg_data_t *pgdat, unsigned long physaddr,
 				 unsigned long size, int flags)
 {
 	int ret;
 
 	ret = can_reserve_bootmem_core(pgdat->bdata, physaddr, size, flags);
 	if (ret < 0)
-		return;
+		return -ENOMEM;
 	reserve_bootmem_core(pgdat->bdata, physaddr, size, flags);
+
+	return 0;
 }
 
 void __init free_bootmem_node(pg_data_t *pgdat, unsigned long physaddr,
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Linux 2.6.26-rc7, Linus Torvalds, (Fri Jun 20, 7:42 pm)
Re: Linux 2.6.26-rc7, Jeff Chua, (Sun Jun 22, 3:12 am)
Re: Linux 2.6.26-rc7, Arjan van de Ven, (Sun Jun 22, 12:58 pm)
Re: Linux 2.6.26-rc7, Jeff Chua, (Mon Jun 23, 11:26 am)
Re: Linux 2.6.26-rc7, Linus Torvalds, (Sun Jun 22, 12:29 pm)
Re: Linux 2.6.26-rc7, Jeff Chua, (Mon Jun 23, 11:18 am)
Re: Linux 2.6.26-rc7, Linus Torvalds, (Sun Jun 22, 1:26 pm)
Re: Linux 2.6.26-rc7, Jeff Chua, (Mon Jun 23, 11:21 am)
2.6.26-rc7: x86 build error, Adrian Bunk, (Sat Jun 21, 5:55 am)
Re: 2.6.26-rc7: x86 build error, Johannes Weiner, (Sat Jun 21, 1:01 pm)