From 3ff50170b6d1c88f35fbabb5802cc855e9bd02e1 Mon Sep 17 00:00:00 2001 From: "Masamichi Takagi m-takagi@ab.jp.nec.com" Date: Tue, 30 Oct 2012 14:12:35 +0900 Subject: [PATCH] make allocate_pages in kernel/mem.c propagate error from aal_pagealloc_alloc (physical address of zero) to callee --- kernel/mem.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/kernel/mem.c b/kernel/mem.c index b0685b6a..c5854936 100644 --- a/kernel/mem.c +++ b/kernel/mem.c @@ -34,7 +34,10 @@ static void reserve_pages(unsigned long start, unsigned long end, int type) void *allocate_pages(int npages, enum aal_mc_ap_flag flag) { - return phys_to_virt(aal_pagealloc_alloc(pa_allocator, npages)); + unsigned long pa = aal_pagealloc_alloc(pa_allocator, npages); + /* all_pagealloc_alloc returns zero when error occured, + and callee (in mcos/kernel/process.c) so propagate it */ + return pa ? phys_to_virt(pa) : 0; } void free_pages(void *va, int npages)