cmd: qfw: remove qemu_fwcfg_free_files()
This patch is part of the qfw refactor work.
The qemu_fwcfg_free_files() function is only used in error handling in
ACPI table generation, let's not make this a core function and move it
to the right place.
Signed-off-by: Miao Yan <yanmiaobest@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
diff --git a/arch/x86/cpu/qemu/acpi_table.c b/arch/x86/cpu/qemu/acpi_table.c
index 49381ac..b17fa03 100644
--- a/arch/x86/cpu/qemu/acpi_table.c
+++ b/arch/x86/cpu/qemu/acpi_table.c
@@ -235,8 +235,17 @@
}
out:
- if (ret)
- qemu_fwcfg_free_files();
+ if (ret) {
+ struct fw_cfg_file_iter iter;
+ for (file = qemu_fwcfg_file_iter_init(&iter);
+ !qemu_fwcfg_file_iter_end(&iter);
+ file = qemu_fwcfg_file_iter_next(&iter)) {
+ if (file->addr) {
+ free((void *)file->addr);
+ file->addr = 0;
+ }
+ }
+ }
free(table_loader);
return addr;