diff options
author | Heinrich Schuchardt <xypron.glpk@gmx.de> | 2020-06-29 20:08:49 +0200 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2020-07-17 10:47:19 -0400 |
commit | 1244f369006370722dbcca9fb26e59458d462567 (patch) | |
tree | 973e620ee4426fc89ccef58992692f3efa0286c5 /fs | |
parent | 36da57aa8784af486b79b49d1e644f2ca20f9e3a (diff) | |
download | u-boot-1244f369006370722dbcca9fb26e59458d462567.tar.gz u-boot-1244f369006370722dbcca9fb26e59458d462567.tar.bz2 u-boot-1244f369006370722dbcca9fb26e59458d462567.zip |
fs: error handling in do_load()
If a file cannot be loaded, show an error message.
Set the EFI boot device only after successfully loading a file.
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/fs.c | 12 |
1 files changed, 7 insertions, 5 deletions
@@ -715,15 +715,17 @@ int do_load(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[], else pos = 0; -#ifdef CONFIG_CMD_BOOTEFI - efi_set_bootdev(argv[1], (argc > 2) ? argv[2] : "", - (argc > 4) ? argv[4] : ""); -#endif time = get_timer(0); ret = _fs_read(filename, addr, pos, bytes, 1, &len_read); time = get_timer(time); - if (ret < 0) + if (ret < 0) { + printf("Failed to load '%s'\n", filename); return 1; + } + + if (IS_ENABLED(CONFIG_CMD_BOOTEFI)) + efi_set_bootdev(argv[1], (argc > 2) ? argv[2] : "", + (argc > 4) ? argv[4] : ""); printf("%llu bytes read in %lu ms", len_read, time); if (time > 0) { |