summaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorAhmad Fatoum <a.fatoum@pengutronix.de>2021-05-31 09:12:36 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2021-06-02 08:37:23 +0200
commite63077f60ec743cd5535db2f5d49bbf0e9b95335 (patch)
treea1b0cef546a54d37ef8de9709b22f22ee0ca1b04 /arch
parent0a78ac84e9fe3e91d9b01b1e128ea493c6ebc3f4 (diff)
downloadbarebox-e63077f60ec743cd5535db2f5d49bbf0e9b95335.tar.gz
barebox-e63077f60ec743cd5535db2f5d49bbf0e9b95335.tar.xz
of: propagate errors inside barebox_register_{of, fdt} into initcalls
Errors during device tree registration, while uncommon, are really annoying, because the system may limp along and it's not clear where the misbehavior originates from. Failing the initcall of the device tree would improve user experience in that error case. There is intentionally no early exit on error cases to give barebox a chance to probe the serial driver to actually report errors when DEBUG_LL is disabled. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20210531071239.30653-4-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/boards/qemu-virt/board.c3
-rw-r--r--arch/arm/cpu/dtb.c4
-rw-r--r--arch/kvx/lib/dtb.c4
-rw-r--r--arch/mips/boot/dtb.c4
-rw-r--r--arch/openrisc/lib/dtb.c4
-rw-r--r--arch/riscv/lib/dtb.c5
-rw-r--r--arch/sandbox/board/dtb.c4
7 files changed, 9 insertions, 19 deletions
diff --git a/arch/arm/boards/qemu-virt/board.c b/arch/arm/boards/qemu-virt/board.c
index d0a7e3da4f..5ce1ecfc24 100644
--- a/arch/arm/boards/qemu-virt/board.c
+++ b/arch/arm/boards/qemu-virt/board.c
@@ -40,9 +40,8 @@ static int replace_dtb(void) {
overlay = of_unflatten_dtb(__dtb_overlay_of_flash_start);
of_overlay_apply_tree(root, overlay);
- barebox_register_of(root);
- return 0;
+ return barebox_register_of(root);
}
pure_initcall(replace_dtb);
diff --git a/arch/arm/cpu/dtb.c b/arch/arm/cpu/dtb.c
index 35f251d99a..9aa979ca08 100644
--- a/arch/arm/cpu/dtb.c
+++ b/arch/arm/cpu/dtb.c
@@ -26,8 +26,6 @@ static int of_arm_init(void)
return 0;
}
- barebox_register_fdt(fdt);
-
- return 0;
+ return barebox_register_fdt(fdt);
}
core_initcall(of_arm_init);
diff --git a/arch/kvx/lib/dtb.c b/arch/kvx/lib/dtb.c
index 09898017c9..3d65bd7bd4 100644
--- a/arch/kvx/lib/dtb.c
+++ b/arch/kvx/lib/dtb.c
@@ -9,8 +9,6 @@
static int of_kvx_init(void)
{
- barebox_register_fdt(boot_dtb);
-
- return 0;
+ return barebox_register_fdt(boot_dtb);
}
core_initcall(of_kvx_init);
diff --git a/arch/mips/boot/dtb.c b/arch/mips/boot/dtb.c
index 6fce4700cc..dbb6315d1f 100644
--- a/arch/mips/boot/dtb.c
+++ b/arch/mips/boot/dtb.c
@@ -41,8 +41,6 @@ static int of_mips_init(void)
if (!fdt)
fdt = __dtb_start;
- barebox_register_fdt(fdt);
-
- return 0;
+ return barebox_register_fdt(fdt);
}
core_initcall(of_mips_init);
diff --git a/arch/openrisc/lib/dtb.c b/arch/openrisc/lib/dtb.c
index 61cf35ddf3..0507eed1d7 100644
--- a/arch/openrisc/lib/dtb.c
+++ b/arch/openrisc/lib/dtb.c
@@ -28,8 +28,6 @@ static int of_openrisc_init(void)
if (root)
return 0;
- barebox_register_fdt(__dtb_start);
-
- return 0;
+ return barebox_register_fdt(__dtb_start);
}
core_initcall(of_openrisc_init);
diff --git a/arch/riscv/lib/dtb.c b/arch/riscv/lib/dtb.c
index 8c2f5b2518..aa28795387 100644
--- a/arch/riscv/lib/dtb.c
+++ b/arch/riscv/lib/dtb.c
@@ -9,6 +9,7 @@
static int of_riscv_init(void)
{
void *fdt;
+ int ret;
/* See if we are provided a dtb in boarddata */
fdt = barebox_riscv_boot_dtb();
@@ -20,11 +21,11 @@ static int of_riscv_init(void)
pr_debug("using boarddata provided DTB\n");
- barebox_register_fdt(fdt);
+ ret = barebox_register_fdt(fdt);
/* do it now, before clocksource drivers run postcore */
timer_init();
- return 0;
+ return ret;
}
core_initcall(of_riscv_init);
diff --git a/arch/sandbox/board/dtb.c b/arch/sandbox/board/dtb.c
index 4a8cbfb26f..98d2e774b8 100644
--- a/arch/sandbox/board/dtb.c
+++ b/arch/sandbox/board/dtb.c
@@ -39,8 +39,6 @@ static int of_sandbox_init(void)
if (!dtb)
dtb = __dtb_sandbox_start;
- barebox_register_fdt(dtb);
-
- return 0;
+ return barebox_register_fdt(dtb);
}
core_initcall(of_sandbox_init);