Skip to content

Commit

Permalink
memblock: fix memblock_is_region_memory()
Browse files Browse the repository at this point in the history
memblock_is_region_memory() uses reserved memblocks to search for the
given region, while it should use the memory memblocks.

I encountered the problem with OMAP's framebuffer ram allocation.
Normally the ram is allocated dynamically, and this function is not
called.  However, if we want to pass the framebuffer from the bootloader
to the kernel (to retain the boot image), this function is used to check
the validity of the kernel parameters for the framebuffer ram area.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@nokia.com>
Acked-by: Yinghai Lu <yinghai@kernel.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Tomi Valkeinen authored and Linus Torvalds committed Jan 21, 2011
1 parent 453c719 commit abb6527
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions mm/memblock.c
Original file line number Diff line number Diff line change
Expand Up @@ -683,13 +683,13 @@ int __init_memblock memblock_is_memory(phys_addr_t addr)

int __init_memblock memblock_is_region_memory(phys_addr_t base, phys_addr_t size)
{
int idx = memblock_search(&memblock.reserved, base);
int idx = memblock_search(&memblock.memory, base);

if (idx == -1)
return 0;
return memblock.reserved.regions[idx].base <= base &&
(memblock.reserved.regions[idx].base +
memblock.reserved.regions[idx].size) >= (base + size);
return memblock.memory.regions[idx].base <= base &&
(memblock.memory.regions[idx].base +
memblock.memory.regions[idx].size) >= (base + size);
}

int __init_memblock memblock_is_region_reserved(phys_addr_t base, phys_addr_t size)
Expand Down

0 comments on commit abb6527

Please sign in to comment.