mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] boot: don't print error message on -ENOMEDIUM
@ 2023-06-12 13:03 Ahmad Fatoum
  2023-06-13  7:14 ` Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: Ahmad Fatoum @ 2023-06-12 13:03 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

It can be expected for a boot entry to usually fail, e.g. when it checks
for a removable USB drive that's not always connected. Such boot targets
have the choice of either returning 0, which means it was a dry run and
boot aborts or an error code, which yields an error message.

Let's handle -ENOMEDIUM specially and not print an error for it, so it
can be used in such scenarios.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 common/boot.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/common/boot.c b/common/boot.c
index 9c6fc3044271..4edea682219b 100644
--- a/common/boot.c
+++ b/common/boot.c
@@ -151,7 +151,7 @@ int boot_entry(struct bootentry *be, int verbose, int dryrun)
 	}
 
 	ret = be->boot(be, verbose, dryrun);
-	if (ret)
+	if (ret && ret != -ENOMEDIUM)
 		pr_err("Booting entry '%s' failed\n", be->title);
 
 	return ret;
-- 
2.39.2




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

* Re: [PATCH] boot: don't print error message on -ENOMEDIUM
  2023-06-12 13:03 [PATCH] boot: don't print error message on -ENOMEDIUM Ahmad Fatoum
@ 2023-06-13  7:14 ` Sascha Hauer
  0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2023-06-13  7:14 UTC (permalink / raw)
  To: Ahmad Fatoum; +Cc: barebox

On Mon, Jun 12, 2023 at 03:03:22PM +0200, Ahmad Fatoum wrote:
> It can be expected for a boot entry to usually fail, e.g. when it checks
> for a removable USB drive that's not always connected. Such boot targets
> have the choice of either returning 0, which means it was a dry run and
> boot aborts or an error code, which yields an error message.
> 
> Let's handle -ENOMEDIUM specially and not print an error for it, so it
> can be used in such scenarios.
> 
> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
> ---
>  common/boot.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Applied, thanks

Sascha

> 
> diff --git a/common/boot.c b/common/boot.c
> index 9c6fc3044271..4edea682219b 100644
> --- a/common/boot.c
> +++ b/common/boot.c
> @@ -151,7 +151,7 @@ int boot_entry(struct bootentry *be, int verbose, int dryrun)
>  	}
>  
>  	ret = be->boot(be, verbose, dryrun);
> -	if (ret)
> +	if (ret && ret != -ENOMEDIUM)
>  		pr_err("Booting entry '%s' failed\n", be->title);
>  
>  	return ret;
> -- 
> 2.39.2
> 
> 
> 

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



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

end of thread, other threads:[~2023-06-13  7:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-12 13:03 [PATCH] boot: don't print error message on -ENOMEDIUM Ahmad Fatoum
2023-06-13  7:14 ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox