fdt: Allow ft_board_setup() to report failure

This function can fail if the device tree runs out of space. Rather than
silently booting with an incomplete device tree, allow the failure to be
detected.

Unfortunately this involves changing a lot of places in the code. I have
not changed behvaiour to return an error where one is not currently
returned, to avoid unexpected breakage.

Eventually it would be nice to allow boards to register functions to be
called to update the device tree. This would avoid all the many functions
to do this. However it's not clear yet if this should be done using driver
model or with a linker list. This work is left for later.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>
diff --git a/board/gateworks/gw_ventana/gw_ventana.c b/board/gateworks/gw_ventana/gw_ventana.c
index df491a8..bb08cd2 100644
--- a/board/gateworks/gw_ventana/gw_ventana.c
+++ b/board/gateworks/gw_ventana/gw_ventana.c
@@ -1483,7 +1483,7 @@
  *  - board (full model from EEPROM)
  *  - peripherals removed from DTB if not loaded on board (per EEPROM config)
  */
-void ft_board_setup(void *blob, bd_t *bd)
+int ft_board_setup(void *blob, bd_t *bd)
 {
 	struct ventana_board_info *info = &ventana_info;
 	struct ventana_eeprom_config *cfg;
@@ -1495,7 +1495,7 @@
 
 	if (getenv("fdt_noauto")) {
 		puts("   Skiping ft_board_setup (fdt_noauto defined)\n");
-		return;
+		return 0;
 	}
 
 	/* Update partition nodes using info from mtdparts env var */
@@ -1504,7 +1504,7 @@
 
 	if (!model) {
 		puts("invalid board info: Leaving FDT fully enabled\n");
-		return;
+		return 0;
 	}
 	printf("   Adjusting FDT per EEPROM for %s...\n", model);
 
@@ -1523,7 +1523,7 @@
 	 */
 	if (getenv("fdt_noconfig")) {
 		puts("   Skiping periperhal config (fdt_noconfig defined)\n");
-		return;
+		return 0;
 	}
 	cfg = econfig;
 	while (cfg->name) {
@@ -1533,6 +1533,8 @@
 		}
 		cfg++;
 	}
+
+	return 0;
 }
 #endif /* defined(CONFIG_OF_FLAT_TREE) && defined(CONFIG_OF_BOARD_SETUP) */