Commit 25818f0f288cd5333ba5a90ad6dde3def4c4ff58

Authored by Benjamin Herrenschmidt
1 parent 37d8d4bf48

memblock: Make MEMBLOCK_ERROR be 0

And ensure we don't hand out 0 as a valid allocation. We put the
low limit at PAGE_SIZE arbitrarily.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>

Showing 2 changed files with 7 additions and 1 deletions Side-by-side Diff

include/linux/memblock.h
... ... @@ -19,7 +19,7 @@
19 19 #include <asm/memblock.h>
20 20  
21 21 #define INIT_MEMBLOCK_REGIONS 128
22   -#define MEMBLOCK_ERROR (~(phys_addr_t)0)
  22 +#define MEMBLOCK_ERROR 0
23 23  
24 24 struct memblock_region {
25 25 phys_addr_t base;
... ... @@ -105,6 +105,12 @@
105 105 phys_addr_t base, res_base;
106 106 long j;
107 107  
  108 + /* Prevent allocations returning 0 as it's also used to
  109 + * indicate an allocation failure
  110 + */
  111 + if (start == 0)
  112 + start = PAGE_SIZE;
  113 +
108 114 base = memblock_align_down((end - size), align);
109 115 while (start <= base) {
110 116 j = memblock_overlaps_region(&memblock.reserved, base, size);