lmb: change the return code on lmb_alloc_addr()
Ben reports a failure to boot the kernel on hardware that starts its
physical memory from 0x0.
The reason is that lmb_alloc_addr(), which is supposed to reserve a
specific address, takes the address as the first argument, but then also
returns the address for success or failure and treats 0 as a failure.
Since we already know the address change the prototype to return an int.
Reported-by: Ben Schneider <ben@bens.haus>
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Tested-by: Ben Schneider <ben@bens.haus>
Reviewed-by: Sughosh Ganu <sughosh.ganu@linaro.org>
diff --git a/include/lmb.h b/include/lmb.h
index 09297a4..0d316c6 100644
--- a/include/lmb.h
+++ b/include/lmb.h
@@ -135,9 +135,9 @@
* parameter. The base parameter is used to specify the base address
* of the requested region.
*
- * Return: Base address on success, 0 on error.
+ * Return: 0 on success -1 on error
*/
-phys_addr_t lmb_alloc_addr(phys_addr_t base, phys_size_t size, u32 flags);
+int lmb_alloc_addr(phys_addr_t base, phys_size_t size, u32 flags);
/**
* lmb_is_reserved_flags() - Test if address is in reserved region with flag
@@ -175,7 +175,7 @@
static inline int lmb_read_check(phys_addr_t addr, phys_size_t len)
{
- return lmb_alloc_addr(addr, len, LMB_NONE) == addr ? 0 : -1;
+ return lmb_alloc_addr(addr, len, LMB_NONE);
}
/**