[PATCH master 3/3] RISC-V: cpu: fix initcall return code on request_barebox_region error

Ahmad Fatoum a.fatoum at pengutronix.de
Mon Jul 22 10:06:06 PDT 2024


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

Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
 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




More information about the barebox mailing list