]> git.proxmox.com Git - mirror_qemu.git/commitdiff
ioport: split deletion and destruction
authorPaolo Bonzini <pbonzini@redhat.com>
Wed, 11 Jun 2014 11:02:51 +0000 (13:02 +0200)
committerPaolo Bonzini <pbonzini@redhat.com>
Sun, 17 Aug 2014 21:25:24 +0000 (23:25 +0200)
Of the two functions portio_list_del and portio_list_destroy,
the latter is just freeing a memory area.  However, portio_list_del
is the logical equivalent of memory_region_del_subregion so
destruction of memory regions does not belong there.

Actually, neither of these APIs are in use; portio is mostly used by
ISA devices or VGAs, and neither of these is currently hot-unpluggable.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
ioport.c

index 3d91e79edcb9e4021b824ad4e4e6b46b2b3e93b7..dce94a313044e35bdd841a9499c2f218f848ee72 100644 (file)
--- a/ioport.c
+++ b/ioport.c
@@ -149,6 +149,14 @@ void portio_list_set_flush_coalesced(PortioList *piolist)
 
 void portio_list_destroy(PortioList *piolist)
 {
+    MemoryRegionPortioList *mrpio;
+    unsigned i;
+
+    for (i = 0; i < piolist->nr; ++i) {
+        mrpio = container_of(piolist->regions[i], MemoryRegionPortioList, mr);
+        memory_region_destroy(&mrpio->mr);
+        g_free(mrpio);
+    }
     g_free(piolist->regions);
 }
 
@@ -291,8 +299,5 @@ void portio_list_del(PortioList *piolist)
     for (i = 0; i < piolist->nr; ++i) {
         mrpio = container_of(piolist->regions[i], MemoryRegionPortioList, mr);
         memory_region_del_subregion(piolist->address_space, &mrpio->mr);
-        memory_region_destroy(&mrpio->mr);
-        g_free(mrpio);
-        piolist->regions[i] = NULL;
     }
 }