fdt_support: Don't panic if stdout alias is missing

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>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <yorksun@freescale.com>
This commit is contained in:
Scott Wood 2015-09-01 22:48:08 -05:00 committed by York Sun
parent 6b6db0d509
commit da77c81990

View file

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