mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] state: don't report error for -ENOMEDIUM
@ 2022-06-20  7:19 Ahmad Fatoum
  2022-06-20  9:38 ` Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: Ahmad Fatoum @ 2022-06-20  7:19 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

Since commit 863a2251393e ("state: make first boot less verbose"),
state_load returns -ENOMEDIUM instead of -ENOENT if we detect
a first load because all buckets are zero.

This case is expected and shouldn't warrant an error message, so
adjust callers appropriately.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 commands/state.c          | 3 +++
 common/efi/payload/init.c | 2 +-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/commands/state.c b/commands/state.c
index e7cb9902f71a..56ef93b19fa4 100644
--- a/commands/state.c
+++ b/commands/state.c
@@ -53,6 +53,9 @@ static int do_state(int argc, char *argv[])
 		ret = state_save(state);
 	}
 
+	if (ret == -ENOMEDIUM)
+		ret = 0;
+
 	return ret;
 }
 
diff --git a/common/efi/payload/init.c b/common/efi/payload/init.c
index e2bddabc9a42..6976285fb3c3 100644
--- a/common/efi/payload/init.c
+++ b/common/efi/payload/init.c
@@ -359,7 +359,7 @@ static int efi_late_init(void)
 			return PTR_ERR(state);
 
 		ret = state_load(state);
-		if (ret)
+		if (ret != -ENOMEDIUM)
 			pr_warn("Failed to load persistent state, continuing with defaults, %d\n",
 				ret);
 
-- 
2.30.2




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

* Re: [PATCH] state: don't report error for -ENOMEDIUM
  2022-06-20  7:19 [PATCH] state: don't report error for -ENOMEDIUM Ahmad Fatoum
@ 2022-06-20  9:38 ` Sascha Hauer
  0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2022-06-20  9:38 UTC (permalink / raw)
  To: Ahmad Fatoum; +Cc: barebox

On Mon, Jun 20, 2022 at 09:19:36AM +0200, Ahmad Fatoum wrote:
> Since commit 863a2251393e ("state: make first boot less verbose"),
> state_load returns -ENOMEDIUM instead of -ENOENT if we detect
> a first load because all buckets are zero.
> 
> This case is expected and shouldn't warrant an error message, so
> adjust callers appropriately.
> 
> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
> ---
>  commands/state.c          | 3 +++
>  common/efi/payload/init.c | 2 +-
>  2 files changed, 4 insertions(+), 1 deletion(-)

Applied, thanks

Sascha

> 
> diff --git a/commands/state.c b/commands/state.c
> index e7cb9902f71a..56ef93b19fa4 100644
> --- a/commands/state.c
> +++ b/commands/state.c
> @@ -53,6 +53,9 @@ static int do_state(int argc, char *argv[])
>  		ret = state_save(state);
>  	}
>  
> +	if (ret == -ENOMEDIUM)
> +		ret = 0;
> +
>  	return ret;
>  }
>  
> diff --git a/common/efi/payload/init.c b/common/efi/payload/init.c
> index e2bddabc9a42..6976285fb3c3 100644
> --- a/common/efi/payload/init.c
> +++ b/common/efi/payload/init.c
> @@ -359,7 +359,7 @@ static int efi_late_init(void)
>  			return PTR_ERR(state);
>  
>  		ret = state_load(state);
> -		if (ret)
> +		if (ret != -ENOMEDIUM)
>  			pr_warn("Failed to load persistent state, continuing with defaults, %d\n",
>  				ret);
>  
> -- 
> 2.30.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:[~2022-06-20  9:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-20  7:19 [PATCH] state: don't report error for -ENOMEDIUM Ahmad Fatoum
2022-06-20  9:38 ` Sascha Hauer

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