All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] fs: error handling in do_load()
@ 2020-06-27  8:19 Heinrich Schuchardt
  2020-06-29 17:26 ` Simon Glass
  0 siblings, 1 reply; 2+ messages in thread
From: Heinrich Schuchardt @ 2020-06-27  8:19 UTC (permalink / raw)
  To: u-boot

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>
---
 fs/fs.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/fs/fs.c b/fs/fs.c
index ad4caaeb1e..12fa5a6489 100644
--- a/fs/fs.c
+++ b/fs/fs.c
@@ -715,15 +715,18 @@ 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;
+	}
+
+#ifdef CONFIG_CMD_BOOTEFI
+	efi_set_bootdev(argv[1], (argc > 2) ? argv[2] : "",
+			(argc > 4) ? argv[4] : "");
+#endif

 	printf("%llu bytes read in %lu ms", len_read, time);
 	if (time > 0) {
--
2.27.0

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [PATCH 1/1] fs: error handling in do_load()
  2020-06-27  8:19 [PATCH 1/1] fs: error handling in do_load() Heinrich Schuchardt
@ 2020-06-29 17:26 ` Simon Glass
  0 siblings, 0 replies; 2+ messages in thread
From: Simon Glass @ 2020-06-29 17:26 UTC (permalink / raw)
  To: u-boot

On Sat, 27 Jun 2020 at 02:24, Heinrich Schuchardt <xypron.glpk@gmx.de> wrote:
>
> 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>
> ---
>  fs/fs.c | 13 ++++++++-----
>  1 file changed, 8 insertions(+), 5 deletions(-)
>

Reviewed-by: Simon Glass <sjg@chromium.org>

> diff --git a/fs/fs.c b/fs/fs.c
> index ad4caaeb1e..12fa5a6489 100644
> --- a/fs/fs.c
> +++ b/fs/fs.c
> @@ -715,15 +715,18 @@ 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;
> +       }
> +
> +#ifdef CONFIG_CMD_BOOTEFI
> +       efi_set_bootdev(argv[1], (argc > 2) ? argv[2] : "",
> +                       (argc > 4) ? argv[4] : "");
> +#endif

Can this use if() instead?

>
>         printf("%llu bytes read in %lu ms", len_read, time);
>         if (time > 0) {
> --
> 2.27.0
>

Regards,
Simon

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-06-29 17:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-27  8:19 [PATCH 1/1] fs: error handling in do_load() Heinrich Schuchardt
2020-06-29 17:26 ` Simon Glass

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.