[PATCH 6/7] fastboot: add function to free a list of fastboot variables

Sascha Hauer s.hauer at pengutronix.de
Wed Feb 14 23:47:56 PST 2024


With followup patches we'll maintain two lists of fastboot variables. As
a preparation create a function which frees fastboot variables on a
list.

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

diff --git a/common/fastboot.c b/common/fastboot.c
index eaf99b08f4..f41c02a576 100644
--- a/common/fastboot.c
+++ b/common/fastboot.c
@@ -195,16 +195,21 @@ int fastboot_generic_init(struct fastboot *fb, bool export_bbu)
 	return 0;
 }
 
-void fastboot_generic_free(struct fastboot *fb)
+static void fastboot_free_variables(struct list_head *list)
 {
 	struct fb_variable *var, *tmp;
 
-	list_for_each_entry_safe(var, tmp, &fb->variables, list) {
+	list_for_each_entry_safe(var, tmp, list, list) {
 		free(var->name);
 		free(var->value);
 		list_del(&var->list);
 		free(var);
 	}
+}
+
+void fastboot_generic_free(struct fastboot *fb)
+{
+	fastboot_free_variables(&fb->variables);
 
 	free(fb->tempname);
 
-- 
2.39.2




More information about the barebox mailing list