diff options
Diffstat (limited to 'mm/memblock.c')
| -rw-r--r-- | mm/memblock.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/mm/memblock.c b/mm/memblock.c index c1d2060e213e..fc7f97b2d994 100644 --- a/mm/memblock.c +++ b/mm/memblock.c | |||
| @@ -22,6 +22,8 @@ static int memblock_debug; | |||
| 22 | static struct memblock_region memblock_memory_init_regions[INIT_MEMBLOCK_REGIONS + 1]; | 22 | static struct memblock_region memblock_memory_init_regions[INIT_MEMBLOCK_REGIONS + 1]; |
| 23 | static struct memblock_region memblock_reserved_init_regions[INIT_MEMBLOCK_REGIONS + 1]; | 23 | static struct memblock_region memblock_reserved_init_regions[INIT_MEMBLOCK_REGIONS + 1]; |
| 24 | 24 | ||
| 25 | #define MEMBLOCK_ERROR (~(phys_addr_t)0) | ||
| 26 | |||
| 25 | static int __init early_memblock(char *p) | 27 | static int __init early_memblock(char *p) |
| 26 | { | 28 | { |
| 27 | if (p && strstr(p, "debug")) | 29 | if (p && strstr(p, "debug")) |
| @@ -326,7 +328,7 @@ static phys_addr_t __init memblock_find_region(phys_addr_t start, phys_addr_t en | |||
| 326 | base = memblock_align_down(res_base - size, align); | 328 | base = memblock_align_down(res_base - size, align); |
| 327 | } | 329 | } |
| 328 | 330 | ||
| 329 | return ~(phys_addr_t)0; | 331 | return MEMBLOCK_ERROR; |
| 330 | } | 332 | } |
| 331 | 333 | ||
| 332 | phys_addr_t __weak __init memblock_nid_range(phys_addr_t start, phys_addr_t end, int *nid) | 334 | phys_addr_t __weak __init memblock_nid_range(phys_addr_t start, phys_addr_t end, int *nid) |
| @@ -353,14 +355,14 @@ static phys_addr_t __init memblock_alloc_nid_region(struct memblock_region *mp, | |||
| 353 | this_end = memblock_nid_range(start, end, &this_nid); | 355 | this_end = memblock_nid_range(start, end, &this_nid); |
| 354 | if (this_nid == nid) { | 356 | if (this_nid == nid) { |
| 355 | phys_addr_t ret = memblock_find_region(start, this_end, size, align); | 357 | phys_addr_t ret = memblock_find_region(start, this_end, size, align); |
| 356 | if (ret != ~(phys_addr_t)0 && | 358 | if (ret != MEMBLOCK_ERROR && |
| 357 | memblock_add_region(&memblock.reserved, ret, size) >= 0) | 359 | memblock_add_region(&memblock.reserved, ret, size) >= 0) |
| 358 | return ret; | 360 | return ret; |
| 359 | } | 361 | } |
| 360 | start = this_end; | 362 | start = this_end; |
| 361 | } | 363 | } |
| 362 | 364 | ||
| 363 | return ~(phys_addr_t)0; | 365 | return MEMBLOCK_ERROR; |
| 364 | } | 366 | } |
| 365 | 367 | ||
| 366 | phys_addr_t __init memblock_alloc_nid(phys_addr_t size, phys_addr_t align, int nid) | 368 | phys_addr_t __init memblock_alloc_nid(phys_addr_t size, phys_addr_t align, int nid) |
| @@ -379,7 +381,7 @@ phys_addr_t __init memblock_alloc_nid(phys_addr_t size, phys_addr_t align, int n | |||
| 379 | for (i = 0; i < mem->cnt; i++) { | 381 | for (i = 0; i < mem->cnt; i++) { |
| 380 | phys_addr_t ret = memblock_alloc_nid_region(&mem->regions[i], | 382 | phys_addr_t ret = memblock_alloc_nid_region(&mem->regions[i], |
| 381 | size, align, nid); | 383 | size, align, nid); |
| 382 | if (ret != ~(phys_addr_t)0) | 384 | if (ret != MEMBLOCK_ERROR) |
| 383 | return ret; | 385 | return ret; |
| 384 | } | 386 | } |
| 385 | 387 | ||
| @@ -430,7 +432,7 @@ phys_addr_t __init __memblock_alloc_base(phys_addr_t size, phys_addr_t align, ph | |||
| 430 | continue; | 432 | continue; |
| 431 | base = min(memblockbase + memblocksize, max_addr); | 433 | base = min(memblockbase + memblocksize, max_addr); |
| 432 | res_base = memblock_find_region(memblockbase, base, size, align); | 434 | res_base = memblock_find_region(memblockbase, base, size, align); |
| 433 | if (res_base != ~(phys_addr_t)0 && | 435 | if (res_base != MEMBLOCK_ERROR && |
| 434 | memblock_add_region(&memblock.reserved, res_base, size) >= 0) | 436 | memblock_add_region(&memblock.reserved, res_base, size) >= 0) |
| 435 | return res_base; | 437 | return res_base; |
| 436 | } | 438 | } |
