summaryrefslogtreecommitdiff
path: root/common/image-fdt.c
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2014-10-23 18:58:53 -0600
committerSimon Glass <sjg@chromium.org>2014-11-21 04:43:17 +0100
commit6f4dbc21e47c5c1dd191cbd2f0fb7252340e0dcb (patch)
treeba0d9a4d1f1f949f8b48a456243d1d7110e4f21b /common/image-fdt.c
parentf3cc44f9849fa7682d759621a74fb189a994e3b2 (diff)
downloadu-boot-imx-6f4dbc21e47c5c1dd191cbd2f0fb7252340e0dcb.zip
u-boot-imx-6f4dbc21e47c5c1dd191cbd2f0fb7252340e0dcb.tar.gz
u-boot-imx-6f4dbc21e47c5c1dd191cbd2f0fb7252340e0dcb.tar.bz2
fdt: Tidy up error handling in image_setup_libfdt()
The message about needing to reset should be printed no matter what error is printed. Also, an error should always be printed. Signed-off-by: Simon Glass <sjg@chromium.org> Acked-by: Anatolij Gustschin <agust@denx.de> Reviewed-by: Tom Rini <trini@ti.com>
Diffstat (limited to 'common/image-fdt.c')
-rw-r--r--common/image-fdt.c30
1 files changed, 20 insertions, 10 deletions
diff --git a/common/image-fdt.c b/common/image-fdt.c
index a39ae1b..b95b678 100644
--- a/common/image-fdt.c
+++ b/common/image-fdt.c
@@ -460,19 +460,25 @@ int image_setup_libfdt(bootm_headers_t *images, void *blob,
{
ulong *initrd_start = &images->initrd_start;
ulong *initrd_end = &images->initrd_end;
- int ret;
+ int ret = -EPERM;
+ int fdt_ret;
if (fdt_chosen(blob) < 0) {
- puts("ERROR: /chosen node create failed");
- puts(" - must RESET the board to recover.\n");
- return -1;
+ printf("ERROR: /chosen node create failed\n");
+ goto err;
}
if (arch_fixup_fdt(blob) < 0) {
- puts("ERROR: arch specific fdt fixup failed");
- return -1;
+ printf("ERROR: arch-specific fdt fixup failed\n");
+ goto err;
+ }
+ if (IMAGE_OF_BOARD_SETUP) {
+ fdt_ret = ft_board_setup(blob, gd->bd);
+ if (fdt_ret) {
+ printf("ERROR: board-specific fdt fixup failed: %s\n",
+ fdt_strerror(fdt_ret));
+ goto err;
+ }
}
- if (IMAGE_OF_BOARD_SETUP)
- ft_board_setup(blob, gd->bd);
fdt_fixup_ethernet(blob);
/* Delete the old LMB reservation */
@@ -481,7 +487,7 @@ int image_setup_libfdt(bootm_headers_t *images, void *blob,
ret = fdt_shrink_to_minimum(blob);
if (ret < 0)
- return ret;
+ goto err;
of_size = ret;
if (*initrd_start && *initrd_end) {
@@ -493,7 +499,7 @@ int image_setup_libfdt(bootm_headers_t *images, void *blob,
fdt_initrd(blob, *initrd_start, *initrd_end);
if (!ft_verify_fdt(blob))
- return -1;
+ goto err;
#if defined(CONFIG_SOC_KEYSTONE)
if (IMAGE_OF_BOARD_SETUP)
@@ -501,4 +507,8 @@ int image_setup_libfdt(bootm_headers_t *images, void *blob,
#endif
return 0;
+err:
+ printf(" - must RESET the board to recover.\n\n");
+
+ return ret;
}