arm: Init SPARSEMEM section for removed memory

If a memblock has been removed with memblock_remove, it will
be skipped in 'for_each_memblock'. If a SPARSEMEM section
is completely enclosed within this removed memblock,
memory_present will never be called and the section will
never be initialized. This will cause garbage dereferences
later on.

This change loops on the memory banks, instead of the memblocks.
Memory banks always exist, regardless of memblock_remove and
ensure that all SPARSEMEM sections will be initialized, even
if they are removed later.

Change-Id: I1b7b0418a7e752f5bf69c3ec2ea8ea17e8ecfec5
Signed-off-by: Jack Cheung <jackc@codeaurora.org>
(cherry picked from commit 7245af9e71b1202d1a972a0bcebea073ce80899a)
This commit is contained in:
Jack Cheung
2011-12-12 17:23:31 -08:00
committed by Stephen Boyd
parent 875b761ed2
commit e31f6193bb

View File

@@ -332,11 +332,12 @@ static void __init arm_memory_present(void)
#else
static void __init arm_memory_present(void)
{
struct memblock_region *reg;
for_each_memblock(memory, reg)
memory_present(0, memblock_region_memory_base_pfn(reg),
memblock_region_memory_end_pfn(reg));
struct meminfo *mi = &meminfo;
int i;
for_each_bank(i, mi) {
memory_present(0, bank_pfn_start(&mi->bank[i]),
bank_pfn_end(&mi->bank[i]));
}
}
#endif