diff options
author | Stephen Rothwell <sfr@canb.auug.org.au> | 2007-10-02 13:37:53 +1000 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2007-10-03 11:48:44 +1000 |
commit | 5669c3cf19fbadaa9120b59914beec8431277efe (patch) | |
tree | 463ead47019486cdbde965ce1ef17045b32ca73f /arch/powerpc/lib/alloc.c | |
parent | 88de3cab98ff6c794b840969427e61605d0cc1ea (diff) | |
download | blackbird-obmc-linux-5669c3cf19fbadaa9120b59914beec8431277efe.tar.gz blackbird-obmc-linux-5669c3cf19fbadaa9120b59914beec8431277efe.zip |
[POWERPC] Limit range of __init_ref_ok somewhat
This patch introduces zalloc_maybe_bootmem and uses it so that we don't
have to mark a whole (largish) routine as __init_ref_ok.
Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch/powerpc/lib/alloc.c')
-rw-r--r-- | arch/powerpc/lib/alloc.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/arch/powerpc/lib/alloc.c b/arch/powerpc/lib/alloc.c index e58c80590ebc..f53e09c7dac7 100644 --- a/arch/powerpc/lib/alloc.c +++ b/arch/powerpc/lib/alloc.c @@ -2,6 +2,7 @@ #include <linux/init.h> #include <linux/slab.h> #include <linux/bootmem.h> +#include <linux/string.h> #include <asm/system.h> @@ -12,3 +13,17 @@ void * __init_refok alloc_maybe_bootmem(size_t size, gfp_t mask) else return alloc_bootmem(size); } + +void * __init_refok zalloc_maybe_bootmem(size_t size, gfp_t mask) +{ + void *p; + + if (mem_init_done) + p = kzalloc(size, mask); + else { + p = alloc_bootmem(size); + if (p) + memset(p, 0, size); + } + return p; +} |