mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 1/2] globalvar: propagate dev_set_param return value from globalvar_set
@ 2026-03-12 14:43 Ahmad Fatoum
  2026-03-12 14:43 ` [PATCH 2/2] globalvar: add helpers for stashing global variables Ahmad Fatoum
  0 siblings, 1 reply; 4+ messages in thread
From: Ahmad Fatoum @ 2026-03-12 14:43 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

dev_set_param() already returns an error code, which can be useful
for non-simple globalvars. Propagate it out of globalvar_set as well.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 common/globalvar.c  | 4 ++--
 include/globalvar.h | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/common/globalvar.c b/common/globalvar.c
index 876379b2538e..c2b0d5b4bbad 100644
--- a/common/globalvar.c
+++ b/common/globalvar.c
@@ -456,9 +456,9 @@ void globalvar_set_match(const char *match, const char *val)
 	}
 }
 
-void globalvar_set(const char *name, const char *val)
+int globalvar_set(const char *name, const char *val)
 {
-	dev_set_param(&global_device, name, val);
+	return dev_set_param(&global_device, name, val);
 }
 
 static int globalvar_simple_set(struct bobject *bobj, struct param_d *p,
diff --git a/include/globalvar.h b/include/globalvar.h
index e369616c632a..413cf72002a0 100644
--- a/include/globalvar.h
+++ b/include/globalvar.h
@@ -22,7 +22,7 @@ int globalvar_add_simple(const char *name, const char *value);
 void globalvar_remove(const char *name);
 char *globalvar_get_match(const char *match, const char *separator);
 void globalvar_set_match(const char *match, const char *val);
-void globalvar_set(const char *name, const char *val);
+int globalvar_set(const char *name, const char *val);
 
 int globalvar_add_simple_string(const char *name, char **value);
 int globalvar_add_simple_int(const char *name, int *value,
@@ -124,7 +124,7 @@ static inline char *globalvar_get_match(const char *match, const char *separator
 
 static inline void globalvar_set_match(const char *match, const char *val) {}
 
-static inline void globalvar_set(const char *name, const char *val) {}
+static inline int globalvar_set(const char *name, const char *val) { return 0; }
 
 static inline int nvvar_load(void)
 {
-- 
2.47.3




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-03-18  9:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-03-12 14:43 [PATCH 1/2] globalvar: propagate dev_set_param return value from globalvar_set Ahmad Fatoum
2026-03-12 14:43 ` [PATCH 2/2] globalvar: add helpers for stashing global variables Ahmad Fatoum
2026-03-18  8:12   ` Sascha Hauer
2026-03-18  9:22     ` Ahmad Fatoum

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox