aboutsummaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorLi Qiang <liq3ea@gmail.com>2017-03-15 20:50:14 -0400
committerJohn Snow <jsnow@redhat.com>2017-03-15 20:50:14 -0400
commitc9f086418a255f386e1c4d2c1418c032eb349537 (patch)
treeae6656d1c9aa9d57915f5edb68a1cab3025a9202 /hw
parent44a109c1b38ddc9f853c33861875d0a85262de4f (diff)
ide: core: add cleanup function
As the pci ahci can be hotplug and unplug, in the ahci unrealize function it should free all the resource once allocated in the realized function. This patch add ide_exit to free the resource. Signed-off-by: Li Qiang <liqiang6-s@360.cn> Message-id: 1488449293-80280-3-git-send-email-liqiang6-s@360.cn Signed-off-by: John Snow <jsnow@redhat.com>
Diffstat (limited to 'hw')
-rw-r--r--hw/ide/core.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/hw/ide/core.c b/hw/ide/core.c
index db509b3e15..0b48b64d3a 100644
--- a/hw/ide/core.c
+++ b/hw/ide/core.c
@@ -2603,6 +2603,14 @@ void ide_init2(IDEBus *bus, qemu_irq irq)
bus->dma = &ide_dma_nop;
}
+void ide_exit(IDEState *s)
+{
+ timer_del(s->sector_write_timer);
+ timer_free(s->sector_write_timer);
+ qemu_vfree(s->smart_selftest_data);
+ qemu_vfree(s->io_buffer);
+}
+
static const MemoryRegionPortio ide_portio_list[] = {
{ 0, 8, 1, .read = ide_ioport_read, .write = ide_ioport_write },
{ 0, 1, 2, .read = ide_data_readw, .write = ide_data_writew },