summaryrefslogtreecommitdiffstats
path: root/mm/memblock.c
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2011-07-12 09:58:09 +0200
committerH. Peter Anvin <hpa@linux.intel.com>2011-07-13 16:36:01 -0700
commit1f5026a7e21e409c2b9dd54f6dfb9446511fb7c5 (patch)
treebcf0529d5f05ea8b685d6c0fddcb3197c2fab49c /mm/memblock.c
parent348968eb151e2569ad0ebe19b2f9c3c25b5c816a (diff)
downloadop-kernel-dev-1f5026a7e21e409c2b9dd54f6dfb9446511fb7c5.zip
op-kernel-dev-1f5026a7e21e409c2b9dd54f6dfb9446511fb7c5.tar.gz
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 9882a88..1969936 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_
/* In case, huge size is requested */
if (end < size)
- return MEMBLOCK_ERROR;
+ return 0;
base = round_down(end - size, align);
@@ -94,7 +94,7 @@ static phys_addr_t __init_memblock memblock_find_region(phys_addr_t start, phys_
base = round_down(res_base - size, align);
}
- return MEMBLOCK_ERROR;
+ return 0;
}
static 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,
if (bottom >= top)
continue;
found = memblock_find_region(bottom, top, size, align);
- if (found != MEMBLOCK_ERROR)
+ if (found)
return found;
}
- return MEMBLOCK_ERROR;
+ return 0;
}
/*
@@ -214,10 +214,10 @@ static int __init_memblock memblock_double_array(struct memblock_type *type)
*/
if (use_slab) {
new_array = kmalloc(new_size, GFP_KERNEL);
- addr = new_array == NULL ? MEMBLOCK_ERROR : __pa(new_array);
+ addr = new_array ? __pa(new_array) : 0;
} else
addr = memblock_find_base(new_size, sizeof(phys_addr_t), 0, MEMBLOCK_ALLOC_ACCESSIBLE);
- if (addr == MEMBLOCK_ERROR) {
+ if (!addr) {
pr_err("memblock: Failed to double %s array from %ld to %ld entries !\n",
memblock_type_name(type), type->max, type->max * 2);
return -1;
@@ -478,8 +478,7 @@ phys_addr_t __init __memblock_alloc_base(phys_addr_t size, phys_addr_t align, ph
size = round_up(size, align);
found = memblock_find_base(size, align, 0, max_addr);
- if (found != MEMBLOCK_ERROR &&
- !memblock_add_region(&memblock.reserved, found, size))
+ if (found && !memblock_add_region(&memblock.reserved, found, size))
return found;
return 0;
@@ -559,14 +558,14 @@ static phys_addr_t __init memblock_alloc_nid_region(struct memblock_region *mp,
this_end = memblock_nid_range(start, end, &this_nid);
if (this_nid == nid) {
phys_addr_t ret = memblock_find_region(start, this_end, size, align);
- if (ret != MEMBLOCK_ERROR &&
+ if (ret &&
!memblock_add_region(&memblock.reserved, ret, size))
return ret;
}
start = this_end;
}
- return MEMBLOCK_ERROR;
+ return 0;
}
phys_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
for (i = 0; i < mem->cnt; i++) {
phys_addr_t ret = memblock_alloc_nid_region(&mem->regions[i],
size, align, nid);
- if (ret != MEMBLOCK_ERROR)
+ if (ret)
return ret;
}
OpenPOWER on IntegriCloud