[PATCH] common: globalvar: fix removing multiple nvvars with wildcards

Sascha Hauer s.hauer at pengutronix.de
Thu Nov 30 03:19:44 PST 2017


nvvar_remove takes wildcards, so it can remove multiple variables. This
means we cannot return after the first loop iteration, but instead must
continue.

Fixes: 609d3edc3ad9 (common: globvar: let nvvar_remove() report non-existing variable)

Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
Cc:
---
 common/globalvar.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/common/globalvar.c b/common/globalvar.c
index ee756e5140..77b89c1791 100644
--- a/common/globalvar.c
+++ b/common/globalvar.c
@@ -247,6 +247,7 @@ int nvvar_remove(const char *name)
 {
 	struct param_d *p, *tmp;
 	char *fname;
+	int ret = -ENOENT;
 
 	if (!IS_ENABLED(CONFIG_NVVAR))
 		return -ENOSYS;
@@ -262,10 +263,10 @@ int nvvar_remove(const char *name)
 		unlink(fname);
 		free(fname);
 
-		return 0;
+		ret = 0;
 	}
 
-	return -ENOENT;
+	return ret;
 }
 
 int nvvar_load(void)
-- 
2.11.0




More information about the barebox mailing list