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>
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 @@
/* In case, huge size is requested */
if (end < size)
- return MEMBLOCK_ERROR;
+ return 0;
base = round_down(end - size, align);
@@ -94,7 +94,7 @@
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 @@
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 @@
*/
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 @@
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 @@
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 @@
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;
}