Patchwork [RFC,v3,3/3] update rom_reset

login
register
mail settings
Submitter Olivia Yin
Date Nov. 1, 2012, 8:50 a.m.
Message ID <1351759856-20677-4-git-send-email-hong-hua.yin@freescale.com>
Download mbox | patch
Permalink /patch/196103/
State New
Headers show

Comments

Olivia Yin - Nov. 1, 2012, 8:50 a.m.
Signed-off-by: Olivia Yin <hong-hua.yin@freescale.com>
---
 hw/loader.c |    9 +++------
 1 files changed, 3 insertions(+), 6 deletions(-)

Patch

diff --git a/hw/loader.c b/hw/loader.c
index 0581c71..17908cf 100644
--- a/hw/loader.c
+++ b/hw/loader.c
@@ -738,11 +738,8 @@  static void rom_reset(void *unused)
             continue;
         }
         cpu_physical_memory_write_rom(rom->addr, rom->data, rom->romsize);
-        if (rom->isrom) {
-            /* rom needs to be written only once */
-            g_free(rom->data);
-            rom->data = NULL;
-        }
+        g_free(rom->data);
+        rom->data = NULL;
     }
 }
 
@@ -767,8 +764,8 @@  int rom_load_all(void)
         addr += rom->romsize;
         section = memory_region_find(get_system_memory(), rom->addr, 1);
         rom->isrom = section.size && memory_region_is_rom(section.mr);
+        qemu_register_reset(rom_reset, rom);
     }
-    qemu_register_reset(rom_reset, NULL);
     roms_loaded = 1;
     return 0;
 }