diff mbox

[U-Boot,v2,2/2] fdt_support: Don't panic if stdout alias is missing

Message ID 1441165688-28917-1-git-send-email-scottwood@freescale.com
State Accepted
Delegated to: York Sun
Headers show

Commit Message

Scott Wood Sept. 2, 2015, 3:48 a.m. UTC
Currently, using fdt_fixup_stdout() on a device tree that is missing
the relevant alias results in this:

WARNING: could not set linux,stdout-path FDT_ERR_NOTFOUND.
ERROR: /chosen node create failed
 - must RESET the board to recover.

FDT creation failed! hanging...### ERROR ### Please RESET the board ###

There is no reason for this to be a fatal error rather than a warning,
and removing this allows for a smooth transition on a platform where
the device tree currently lacks the correct aliases but will have them
in the future.

Signed-off-by: Scott Wood <scottwood@freescale.com>
Cc: Kumar Gala <galak@kernel.crashing.org>
Cc: Simon Glass <sjg@chromium.org>
---
v2: Only continue booting if the problem was a missing alias, not
the inability to write to the device tree.
---
 common/fdt_support.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

Comments

Simon Glass Sept. 2, 2015, 2:05 p.m. UTC | #1
On 1 September 2015 at 21:48, Scott Wood <scottwood@freescale.com> wrote:
> Currently, using fdt_fixup_stdout() on a device tree that is missing
> the relevant alias results in this:
>
> WARNING: could not set linux,stdout-path FDT_ERR_NOTFOUND.
> ERROR: /chosen node create failed
>  - must RESET the board to recover.
>
> FDT creation failed! hanging...### ERROR ### Please RESET the board ###
>
> There is no reason for this to be a fatal error rather than a warning,
> and removing this allows for a smooth transition on a platform where
> the device tree currently lacks the correct aliases but will have them
> in the future.
>
> Signed-off-by: Scott Wood <scottwood@freescale.com>
> Cc: Kumar Gala <galak@kernel.crashing.org>
> Cc: Simon Glass <sjg@chromium.org>
> ---
> v2: Only continue booting if the problem was a missing alias, not
> the inability to write to the device tree.
> ---
>  common/fdt_support.c | 11 ++++++++---
>  1 file changed, 8 insertions(+), 3 deletions(-)

Reviewed-by: Simon Glass <sjg@chromium.org>
York Sun Oct. 30, 2015, 4:12 p.m. UTC | #2
On 09/01/2015 08:48 PM, Scott Wood wrote:
> Currently, using fdt_fixup_stdout() on a device tree that is missing
> the relevant alias results in this:
> 
> WARNING: could not set linux,stdout-path FDT_ERR_NOTFOUND.
> ERROR: /chosen node create failed
>  - must RESET the board to recover.
> 
> FDT creation failed! hanging...### ERROR ### Please RESET the board ###
> 
> There is no reason for this to be a fatal error rather than a warning,
> and removing this allows for a smooth transition on a platform where
> the device tree currently lacks the correct aliases but will have them
> in the future.
> 
> Signed-off-by: Scott Wood <scottwood@freescale.com>
> Cc: Kumar Gala <galak@kernel.crashing.org>
> Cc: Simon Glass <sjg@chromium.org>
> ---
> v2: Only continue booting if the problem was a missing alias, not
> the inability to write to the device tree.
> ---
>  common/fdt_support.c | 11 ++++++++---
>  1 file changed, 8 insertions(+), 3 deletions(-)
> 


Applied to u-boot-fsl-qoriq. Awaiting upstream. Thanks.

York
diff mbox

Patch

diff --git a/common/fdt_support.c b/common/fdt_support.c
index f86365e..a7ff2df 100644
--- a/common/fdt_support.c
+++ b/common/fdt_support.c
@@ -158,25 +158,30 @@  static int fdt_fixup_stdout(void *fdt, int chosenoff)
 	aliasoff = fdt_path_offset(fdt, "/aliases");
 	if (aliasoff < 0) {
 		err = aliasoff;
-		goto error;
+		goto noalias;
 	}
 
 	path = fdt_getprop(fdt, aliasoff, sername, &len);
 	if (!path) {
 		err = len;
-		goto error;
+		goto noalias;
 	}
 
 	/* fdt_setprop may break "path" so we copy it to tmp buffer */
 	memcpy(tmp, path, len);
 
 	err = fdt_setprop(fdt, chosenoff, "linux,stdout-path", tmp, len);
-error:
 	if (err < 0)
 		printf("WARNING: could not set linux,stdout-path %s.\n",
 		       fdt_strerror(err));
 
 	return err;
+
+noalias:
+	printf("WARNING: %s: could not read %s alias: %s\n",
+	       __func__, sername, fdt_strerror(err));
+
+	return 0;
 }
 #else
 static int fdt_fixup_stdout(void *fdt, int chosenoff)