From: Heinrich Schuchardt Date: Mon, 29 Jun 2020 18:08:49 +0000 (+0200) Subject: fs: error handling in do_load() X-Git-Url: http://git.dujemihanovic.xyz/%22/img/sics.gif/%22/static/git-favicon.png?a=commitdiff_plain;h=1244f369006370722dbcca9fb26e59458d462567;p=u-boot.git 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 Reviewed-by: Simon Glass --- diff --git a/fs/fs.c b/fs/fs.c index 8f8938c3c6..edd8adc21b 100644 --- a/fs/fs.c +++ b/fs/fs.c @@ -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) {