diff options
Diffstat (limited to 'kernel/power')
-rw-r--r-- | kernel/power/snapshot.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/kernel/power/snapshot.c b/kernel/power/snapshot.c index 48383ea72290..a3b7854b8f7c 100644 --- a/kernel/power/snapshot.c +++ b/kernel/power/snapshot.c | |||
@@ -607,7 +607,8 @@ static LIST_HEAD(nosave_regions); | |||
607 | */ | 607 | */ |
608 | 608 | ||
609 | void __init | 609 | void __init |
610 | register_nosave_region(unsigned long start_pfn, unsigned long end_pfn) | 610 | __register_nosave_region(unsigned long start_pfn, unsigned long end_pfn, |
611 | int use_kmalloc) | ||
611 | { | 612 | { |
612 | struct nosave_region *region; | 613 | struct nosave_region *region; |
613 | 614 | ||
@@ -623,8 +624,13 @@ register_nosave_region(unsigned long start_pfn, unsigned long end_pfn) | |||
623 | goto Report; | 624 | goto Report; |
624 | } | 625 | } |
625 | } | 626 | } |
626 | /* This allocation cannot fail */ | 627 | if (use_kmalloc) { |
627 | region = alloc_bootmem_low(sizeof(struct nosave_region)); | 628 | /* during init, this shouldn't fail */ |
629 | region = kmalloc(sizeof(struct nosave_region), GFP_KERNEL); | ||
630 | BUG_ON(!region); | ||
631 | } else | ||
632 | /* This allocation cannot fail */ | ||
633 | region = alloc_bootmem_low(sizeof(struct nosave_region)); | ||
628 | region->start_pfn = start_pfn; | 634 | region->start_pfn = start_pfn; |
629 | region->end_pfn = end_pfn; | 635 | region->end_pfn = end_pfn; |
630 | list_add_tail(®ion->list, &nosave_regions); | 636 | list_add_tail(®ion->list, &nosave_regions); |