summaryrefslogtreecommitdiffstats
path: root/mm
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
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')
-rw-r--r--mm/memblock.c21
-rw-r--r--mm/nobootmem.c2
-rw-r--r--mm/page_alloc.c4
3 files changed, 13 insertions, 14 deletions
diff --git a/mm/memblock.c b/mm/memblock.c
index 9882a88d4a1..19699366134 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;
}
diff --git a/mm/nobootmem.c b/mm/nobootmem.c
index 6e93dc7f258..5b0eb06ecb4 100644
--- a/mm/nobootmem.c
+++ b/mm/nobootmem.c
@@ -43,7 +43,7 @@ static void * __init __alloc_memory_core_early(int nid, u64 size, u64 align,
addr = find_memory_core_early(nid, size, align, goal, limit);
- if (addr == MEMBLOCK_ERROR)
+ if (!addr)
return NULL;
ptr = phys_to_virt(addr);
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index b6da6ed818a..c7f0e5be4a3 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -3878,13 +3878,13 @@ u64 __init find_memory_core_early(int nid, u64 size, u64 align,
addr = memblock_find_in_range(final_start, final_end, size, align);
- if (addr == MEMBLOCK_ERROR)
+ if (!addr)
continue;
return addr;
}
- return MEMBLOCK_ERROR;
+ return 0;
}
#endif