aboutsummaryrefslogtreecommitdiffstats
path: root/mm/memblock.c
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2011-07-12 03:58:09 -0400
committerH. Peter Anvin <hpa@linux.intel.com>2011-07-13 19:36:01 -0400
commit1f5026a7e21e409c2b9dd54f6dfb9446511fb7c5 (patch)
treebcf0529d5f05ea8b685d6c0fddcb3197c2fab49c /mm/memblock.c
parent348968eb151e2569ad0ebe19b2f9c3c25b5c816a (diff)
memblock: Kill MEMBLOCK_ERROR
25818f0f28 (memblock: Make MEMBLOCK_ERROR be 0) thankfully made MEMBLOCK_ERROR 0 and there already are codes which expect error return to be 0. There's no point in keeping MEMBLOCK_ERROR around. End its misery. Signed-off-by: Tejun Heo <tj@kernel.org> Link: http://lkml.kernel.org/r/1310457490-3356-6-git-send-email-tj@kernel.org Cc: Yinghai Lu <yinghai@kernel.org> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Diffstat (limited to 'mm/memblock.c')
-rw-r--r--mm/memblock.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/mm/memblock.c b/mm/memblock.c
index 9882a88d4a10..196993661346 100644
--- a/mm/memblock.c
+++ b/mm/memblock.c
@@ -74,7 +74,7 @@ static phys_addr_t __init_memblock memblock_find_region(phys_addr_t start, phys_
74 74
75 /* In case, huge size is requested */ 75 /* In case, huge size is requested */
76 if (end < size) 76 if (end < size)
77 return MEMBLOCK_ERROR; 77 return 0;
78 78
79 base = round_down(end - size, align); 79 base = round_down(end - size, align);
80 80
@@ -94,7 +94,7 @@ static phys_addr_t __init_memblock memblock_find_region(phys_addr_t start, phys_
94 base = round_down(res_base - size, align); 94 base = round_down(res_base - size, align);
95 } 95 }
96 96
97 return MEMBLOCK_ERROR; 97 return 0;
98} 98}
99 99
100static phys_addr_t __init_memblock memblock_find_base(phys_addr_t size, 100static phys_addr_t __init_memblock memblock_find_base(phys_addr_t size,
@@ -126,10 +126,10 @@ static phys_addr_t __init_memblock memblock_find_base(phys_addr_t size,
126 if (bottom >= top) 126 if (bottom >= top)
127 continue; 127 continue;
128 found = memblock_find_region(bottom, top, size, align); 128 found = memblock_find_region(bottom, top, size, align);
129 if (found != MEMBLOCK_ERROR) 129 if (found)
130 return found; 130 return found;
131 } 131 }
132 return MEMBLOCK_ERROR; 132 return 0;
133} 133}
134 134
135/* 135/*
@@ -214,10 +214,10 @@ static int __init_memblock memblock_double_array(struct memblock_type *type)
214 */ 214 */
215 if (use_slab) { 215 if (use_slab) {
216 new_array = kmalloc(new_size, GFP_KERNEL); 216 new_array = kmalloc(new_size, GFP_KERNEL);
217 addr = new_array == NULL ? MEMBLOCK_ERROR : __pa(new_array); 217 addr = new_array ? __pa(new_array) : 0;
218 } else 218 } else
219 addr = memblock_find_base(new_size, sizeof(phys_addr_t), 0, MEMBLOCK_ALLOC_ACCESSIBLE); 219 addr = memblock_find_base(new_size, sizeof(phys_addr_t), 0, MEMBLOCK_ALLOC_ACCESSIBLE);
220 if (addr == MEMBLOCK_ERROR) { 220 if (!addr) {
221 pr_err("memblock: Failed to double %s array from %ld to %ld entries !\n", 221 pr_err("memblock: Failed to double %s array from %ld to %ld entries !\n",
222 memblock_type_name(type), type->max, type->max * 2); 222 memblock_type_name(type), type->max, type->max * 2);
223 return -1; 223 return -1;
@@ -478,8 +478,7 @@ phys_addr_t __init __memblock_alloc_base(phys_addr_t size, phys_addr_t align, ph
478 size = round_up(size, align); 478 size = round_up(size, align);
479 479
480 found = memblock_find_base(size, align, 0, max_addr); 480 found = memblock_find_base(size, align, 0, max_addr);
481 if (found != MEMBLOCK_ERROR && 481 if (found && !memblock_add_region(&memblock.reserved, found, size))
482 !memblock_add_region(&memblock.reserved, found, size))
483 return found; 482 return found;
484 483
485 return 0; 484 return 0;
@@ -559,14 +558,14 @@ static phys_addr_t __init memblock_alloc_nid_region(struct memblock_region *mp,
559 this_end = memblock_nid_range(start, end, &this_nid); 558 this_end = memblock_nid_range(start, end, &this_nid);
560 if (this_nid == nid) { 559 if (this_nid == nid) {
561 phys_addr_t ret = memblock_find_region(start, this_end, size, align); 560 phys_addr_t ret = memblock_find_region(start, this_end, size, align);
562 if (ret != MEMBLOCK_ERROR && 561 if (ret &&
563 !memblock_add_region(&memblock.reserved, ret, size)) 562 !memblock_add_region(&memblock.reserved, ret, size))
564 return ret; 563 return ret;
565 } 564 }
566 start = this_end; 565 start = this_end;
567 } 566 }
568 567
569 return MEMBLOCK_ERROR; 568 return 0;
570} 569}
571 570
572phys_addr_t __init memblock_alloc_nid(phys_addr_t size, phys_addr_t align, int nid) 571phys_addr_t __init memblock_alloc_nid(phys_addr_t size, phys_addr_t align, int nid)
@@ -588,7 +587,7 @@ phys_addr_t __init memblock_alloc_nid(phys_addr_t size, phys_addr_t align, int n
588 for (i = 0; i < mem->cnt; i++) { 587 for (i = 0; i < mem->cnt; i++) {
589 phys_addr_t ret = memblock_alloc_nid_region(&mem->regions[i], 588 phys_addr_t ret = memblock_alloc_nid_region(&mem->regions[i],
590 size, align, nid); 589 size, align, nid);
591 if (ret != MEMBLOCK_ERROR) 590 if (ret)
592 return ret; 591 return ret;
593 } 592 }
594 593