diff options
author | Suzuki K. Poulose <suzuki.poulose@arm.com> | 2015-11-20 12:45:40 -0500 |
---|---|---|
committer | Catalin Marinas <catalin.marinas@arm.com> | 2015-11-25 07:14:25 -0500 |
commit | 7142392dcac240b37cce8a246225bb11213246cc (patch) | |
tree | cfe5f8ae15b57016f2fd204ea39830c669b56eb1 | |
parent | 1ec218373b8ebda821aec00bb156a9c94fad9cd4 (diff) |
arm64: early_alloc: Fix check for allocation failure
In early_alloc we check if the memblock_alloc failed by checking
the virtual address of the result, which will never fail. This patch
fixes it to check the actual result for failure.
Acked-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Suzuki K. Poulose <suzuki.poulose@arm.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
-rw-r--r-- | arch/arm64/mm/mmu.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c index abb66f84d4ac..78d91b1eab84 100644 --- a/arch/arm64/mm/mmu.c +++ b/arch/arm64/mm/mmu.c | |||
@@ -64,8 +64,12 @@ EXPORT_SYMBOL(phys_mem_access_prot); | |||
64 | 64 | ||
65 | static void __init *early_alloc(unsigned long sz) | 65 | static void __init *early_alloc(unsigned long sz) |
66 | { | 66 | { |
67 | void *ptr = __va(memblock_alloc(sz, sz)); | 67 | phys_addr_t phys; |
68 | BUG_ON(!ptr); | 68 | void *ptr; |
69 | |||
70 | phys = memblock_alloc(sz, sz); | ||
71 | BUG_ON(!phys); | ||
72 | ptr = __va(phys); | ||
69 | memset(ptr, 0, sz); | 73 | memset(ptr, 0, sz); |
70 | return ptr; | 74 | return ptr; |
71 | } | 75 | } |