diff mbox series

[2/2] env: add failing trace in env_erase

Message ID 20221214165126.2.I10631f84f71a23c2c3c6ede7299743000ce82ccd@changeid
State Accepted
Commit 1c44d1087925263a428bee68d30ac9dec6f224e5
Delegated to: Tom Rini
Headers show
Series [1/2] env: ubi: add support of command env erase | expand

Commit Message

Patrick Delaunay Dec. 14, 2022, 3:51 p.m. UTC
Add trace in env save to indicate any errors to end user and avoid
silent output when the command 'env erase' is not executed as it is
done in env_save with commit 8968288cb477 ("env: add failing trace in
env_save")

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
---

 env/env.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

Comments

Patrice CHOTARD Jan. 3, 2023, 1:13 p.m. UTC | #1
Hi Patrick

On 12/14/22 16:51, Patrick Delaunay wrote:
> Add trace in env save to indicate any errors to end user and avoid
> silent output when the command 'env erase' is not executed as it is
> done in env_save with commit 8968288cb477 ("env: add failing trace in
> env_save")
> 
> Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
> Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
> ---
> 
>  env/env.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/env/env.c b/env/env.c
> index 69848fb06080..06078c7f3744 100644
> --- a/env/env.c
> +++ b/env/env.c
> @@ -311,11 +311,15 @@ int env_erase(void)
>  	if (drv) {
>  		int ret;
>  
> -		if (!drv->erase)
> +		if (!drv->erase) {
> +			printf("not possible\n");
>  			return -ENODEV;
> +		}
>  
> -		if (!env_has_inited(drv->location))
> +		if (!env_has_inited(drv->location)) {
> +			printf("not initialized\n");
>  			return -ENODEV;
> +		}
>  
>  		printf("Erasing Environment on %s... ", drv->name);
>  		ret = drv->erase();
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>

Thanks
Patrice
Heiko Schocher Jan. 11, 2023, 11:04 a.m. UTC | #2
Hello Patrick,

On 14.12.22 16:51, Patrick Delaunay wrote:
> Add trace in env save to indicate any errors to end user and avoid
> silent output when the command 'env erase' is not executed as it is
> done in env_save with commit 8968288cb477 ("env: add failing trace in
> env_save")
> 
> Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
> Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
> Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
> ---
> 
>  env/env.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)

Reviewed-by: Heiko Schocher <hs@denx.de>

bye,
Heiko
Tom Rini Jan. 12, 2023, 3:18 p.m. UTC | #3
On Wed, Dec 14, 2022 at 04:51:32PM +0100, Patrick Delaunay wrote:

> Add trace in env save to indicate any errors to end user and avoid
> silent output when the command 'env erase' is not executed as it is
> done in env_save with commit 8968288cb477 ("env: add failing trace in
> env_save")
> 
> Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
> Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
> Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
> Reviewed-by: Heiko Schocher <hs@denx.de>

Applied to u-boot/master, thanks!
diff mbox series

Patch

diff --git a/env/env.c b/env/env.c
index 69848fb06080..06078c7f3744 100644
--- a/env/env.c
+++ b/env/env.c
@@ -311,11 +311,15 @@  int env_erase(void)
 	if (drv) {
 		int ret;
 
-		if (!drv->erase)
+		if (!drv->erase) {
+			printf("not possible\n");
 			return -ENODEV;
+		}
 
-		if (!env_has_inited(drv->location))
+		if (!env_has_inited(drv->location)) {
+			printf("not initialized\n");
 			return -ENODEV;
+		}
 
 		printf("Erasing Environment on %s... ", drv->name);
 		ret = drv->erase();