]> git.sur5r.net Git - u-boot/commitdiff
cmd: qfw: remove qemu_fwcfg_free_files()
authorMiao Yan <yanmiaobest@gmail.com>
Mon, 23 May 2016 02:37:12 +0000 (19:37 -0700)
committerBin Meng <bmeng.cn@gmail.com>
Mon, 23 May 2016 07:18:00 +0000 (15:18 +0800)
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>
arch/x86/cpu/qemu/acpi_table.c
cmd/qemu_fw_cfg.c
include/qemu_fw_cfg.h

index 49381acd29f83b4700f42cce3e6a9c0814016141..b17fa03bc897cc54121f895d9680bb8039117b8e 100644 (file)
@@ -235,8 +235,17 @@ u32 write_acpi_tables(u32 addr)
        }
 
 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;
index 192b7d18d8192b1daefa80e95c8cd8225ff18af7..9f03ab60ab185555b4c7e22a02040a2f9bdd637f 100644 (file)
@@ -217,18 +217,6 @@ struct fw_file *qemu_fwcfg_find_file(const char *name)
        return NULL;
 }
 
-void qemu_fwcfg_free_files(void)
-{
-       struct fw_file *file;
-       struct list_head *list;
-
-       list_for_each(list, &fw_list) {
-               file = list_entry(list, struct fw_file, list);
-               if (file->addr)
-                       free((void *)file->addr);
-       }
-}
-
 struct fw_file *qemu_fwcfg_file_iter_init(struct fw_cfg_file_iter *iter)
 {
        iter->entry = fw_list.next;
index 19d0ba08b4ced5bcbdafd62c491e93d3f97f4574..986f4b2e5ac7f6d9a06a96f7ff83af1db0e5cdab 100644 (file)
@@ -154,7 +154,6 @@ void qemu_fwcfg_init(void);
 void qemu_fwcfg_read_entry(uint16_t entry, uint32_t length, void *address);
 int qemu_fwcfg_read_firmware_list(void);
 struct fw_file *qemu_fwcfg_find_file(const char *name);
-void qemu_fwcfg_free_files(void);
 
 /**
  * Get system cpu number