2007-09-17 12:08:06 +08:00
|
|
|
#include <linux/types.h>
|
|
|
|
#include <linux/init.h>
|
|
|
|
#include <linux/slab.h>
|
|
|
|
#include <linux/bootmem.h>
|
2007-10-02 11:37:53 +08:00
|
|
|
#include <linux/string.h>
|
2012-03-29 01:30:02 +08:00
|
|
|
#include <asm/setup.h>
|
2007-09-17 12:08:06 +08:00
|
|
|
|
|
|
|
|
2007-10-02 11:37:53 +08:00
|
|
|
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;
|
|
|
|
}
|