mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-12 13:34:10 +08:00
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>
This commit is contained in:
parent
1ec218373b
commit
7142392dca
@ -64,8 +64,12 @@ EXPORT_SYMBOL(phys_mem_access_prot);
|
|||||||
|
|
||||||
static void __init *early_alloc(unsigned long sz)
|
static void __init *early_alloc(unsigned long sz)
|
||||||
{
|
{
|
||||||
void *ptr = __va(memblock_alloc(sz, sz));
|
phys_addr_t phys;
|
||||||
BUG_ON(!ptr);
|
void *ptr;
|
||||||
|
|
||||||
|
phys = memblock_alloc(sz, sz);
|
||||||
|
BUG_ON(!phys);
|
||||||
|
ptr = __va(phys);
|
||||||
memset(ptr, 0, sz);
|
memset(ptr, 0, sz);
|
||||||
return ptr;
|
return ptr;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user