diff options
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 @@ | |||
2 | #include <linux/init.h> | 2 | #include <linux/init.h> |
3 | #include <linux/slab.h> | 3 | #include <linux/slab.h> |
4 | #include <linux/bootmem.h> | 4 | #include <linux/bootmem.h> |
5 | #include <linux/string.h> | ||
5 | 6 | ||
6 | #include <asm/system.h> | 7 | #include <asm/system.h> |
7 | 8 | ||
@@ -12,3 +13,17 @@ void * __init_refok alloc_maybe_bootmem(size_t size, gfp_t mask) | |||
12 | else | 13 | else |
13 | return alloc_bootmem(size); | 14 | return alloc_bootmem(size); |
14 | } | 15 | } |
16 | |||
17 | void * __init_refok zalloc_maybe_bootmem(size_t size, gfp_t mask) | ||
18 | { | ||
19 | void *p; | ||
20 | |||
21 | if (mem_init_done) | ||
22 | p = kzalloc(size, mask); | ||
23 | else { | ||
24 | p = alloc_bootmem(size); | ||
25 | if (p) | ||
26 | memset(p, 0, size); | ||
27 | } | ||
28 | return p; | ||
29 | } | ||