[PATCH] globalvar: call dev_set_param only once when loading nv vars

Ahmad Fatoum a.fatoum at barebox.org
Fri May 1 02:23:51 PDT 2026


globalvar_add_simple() accepts NULL as value to mean that a global
variable should be created, but dev_set_param() should not yet be
called.

Instead we pass a non-NULL value, so dev_set_param() is called once when
adding the variable and once more directly after via nv_set().

Fix this, so dev_set_param() is called only once.

Signed-off-by: Ahmad Fatoum <a.fatoum at barebox.org>
---
 common/globalvar.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/common/globalvar.c b/common/globalvar.c
index 876379b2538e..00f94d98af3d 100644
--- a/common/globalvar.c
+++ b/common/globalvar.c
@@ -236,11 +236,11 @@ static int __nvvar_add(const char *name, const char *value)
 		if (IS_ERR(p))
 			return PTR_ERR(p);
 	}
 
 	/* Create corresponding globalvar if it doesn't exist yet */
-	ret = globalvar_add_simple(name, value);
+	ret = globalvar_add_simple(name, NULL);
 	if (ret && ret != -EEXIST)
 		return ret;
 
 	if (value)
 		return nv_set(p, name, value);
-- 
2.47.3




More information about the barebox mailing list