diff options
author | Zubair Lutfullah Kakakhel <Zubair.Kakakhel@imgtec.com> | 2014-10-28 07:28:34 -0400 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2014-10-28 21:59:25 -0400 |
commit | 30fa0530ff87f6379e046629adfa3f4872a2d353 (patch) | |
tree | f9a397597f80ba6cb0cea8fe79830d42a2056f00 /arch | |
parent | 5df4c8dbbc03f4d7e6b6620dcc6869fa989406ee (diff) |
MIPS: CMA: Do not reserve memory if not required
Even if CMA is disabled, the for_each_memblock macro expands
to run reserve_bootmem once. Hence, reserve_bootmem attempts to
reserve location 0 of size 0.
Add a check to avoid that.
Issue was highlighted during testing with EVA enabled.
resrve_bootmem used to exit gracefully when passed arguments to
reserve 0 size location at 0 without EVA.
But with EVA enabled, macros would point to different addresses
and the code would trigger a BUG.
Signed-off-by: Zubair Lutfullah Kakakhel <Zubair.Kakakhel@imgtec.com>
Tested-by: Markos Chandras <markos.chandras@imgtec.com>
Tested-by: Huacai Chen <chenhc@lemote.com>
Cc: linux-mips@linux-mips.org
Cc: linux-kernel@vger.kernel.org
Patchwork: https://patchwork.linux-mips.org/patch/8231/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/mips/kernel/setup.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c index b3b8f0d9d4a7..d21ec57b6e95 100644 --- a/arch/mips/kernel/setup.c +++ b/arch/mips/kernel/setup.c | |||
@@ -683,7 +683,8 @@ static void __init arch_mem_init(char **cmdline_p) | |||
683 | dma_contiguous_reserve(PFN_PHYS(max_low_pfn)); | 683 | dma_contiguous_reserve(PFN_PHYS(max_low_pfn)); |
684 | /* Tell bootmem about cma reserved memblock section */ | 684 | /* Tell bootmem about cma reserved memblock section */ |
685 | for_each_memblock(reserved, reg) | 685 | for_each_memblock(reserved, reg) |
686 | reserve_bootmem(reg->base, reg->size, BOOTMEM_DEFAULT); | 686 | if (reg->size != 0) |
687 | reserve_bootmem(reg->base, reg->size, BOOTMEM_DEFAULT); | ||
687 | } | 688 | } |
688 | 689 | ||
689 | static void __init resource_init(void) | 690 | static void __init resource_init(void) |