summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2024-02-15 08:47:56 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2024-02-16 12:13:47 +0100
commita8614972b161c82cd4c022833c779e277a05f582 (patch)
treea5cf833baf493340cecd3e731eb239b792e531cf
parent8e9895959d3f24ca9aaf51270f8c29ec466a5668 (diff)
downloadbarebox-a8614972b161.tar.gz
barebox-a8614972b161.tar.xz
fastboot: add function to free a list of fastboot variables
With followup patches we'll maintain two lists of fastboot variables. As a preparation create a function which frees fastboot variables on a list. Reviewed-by: Marco Felsch <m.felsch@pengutronix.de> Link: https://lore.barebox.org/20240215074757.960200-7-s.hauer@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r--common/fastboot.c9
1 files 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);