request_barebox_region returns NULL on error, so adjust the initcall
accordingly.

Signed-off-by: Ahmad Fatoum <[email protected]>
---
 arch/riscv/cpu/core.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/arch/riscv/cpu/core.c b/arch/riscv/cpu/core.c
index ad9030ede78b..4889f774cbb3 100644
--- a/arch/riscv/cpu/core.c
+++ b/arch/riscv/cpu/core.c
@@ -28,7 +28,9 @@
 static int riscv_request_stack(void)
 {
        extern unsigned long riscv_stack_top;
-       return PTR_ERR_OR_ZERO(request_barebox_region("stack", riscv_stack_top 
- STACK_SIZE, STACK_SIZE));
+       return request_barebox_region("stack",
+                                     riscv_stack_top - STACK_SIZE,
+                                     STACK_SIZE) ? 0 : -EINVAL;
 }
 coredevice_initcall(riscv_request_stack);
 
-- 
2.39.2


Reply via email to