summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--common/globalvar.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/common/globalvar.c b/common/globalvar.c
index 52808f8852..ab573cc68d 100644
--- a/common/globalvar.c
+++ b/common/globalvar.c
@@ -233,10 +233,16 @@ static int __nvvar_add(const char *name, const char *value)
if (ret && ret != -EEXIST)
return ret;
- if (!value)
- value = dev_get_param(&global_device, name);
+ if (value)
+ return nv_set(&nv_device, p, value);
+
+ value = dev_get_param(&global_device, name);
+ if (value) {
+ free(p->value);
+ p->value = xstrdup(value);
+ }
- return nv_set(&nv_device, p, value);
+ return 0;
}
int nvvar_add(const char *name, const char *value)