[PATCH 1/3] nvvar: Simplify by using nv_set()

Sascha Hauer s.hauer at pengutronix.de
Wed Jul 6 01:20:25 PDT 2016


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

diff --git a/common/globalvar.c b/common/globalvar.c
index 75e4d43..decd73c 100644
--- a/common/globalvar.c
+++ b/common/globalvar.c
@@ -124,19 +124,10 @@ int nvvar_add(const char *name, const char *value)
 	if (IS_ERR(p))
 		return PTR_ERR(p);
 
-	if (value) {
-		ret = dev_set_param(&global_device, name, value);
-		if (ret)
-			return ret;
-	} else {
+	if (!value)
 		value = dev_get_param(&global_device, name);
-		if (!value)
-			value = "";
-	}
-
-	p->value = xstrdup(value);
 
-	return nv_save(p->name, value);
+	return nv_set(&nv_device, p, value);
 }
 
 int nvvar_remove(const char *name)
-- 
2.8.1




More information about the barebox mailing list