From: Paolo Bonzini Date: Wed, 25 Jun 2014 18:21:37 +0000 (+0200) Subject: serial-pci: remove memory regions from BAR before destroying them X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=7497bce6c2561f1215fe179e40837774f6243799;p=qmiga%2Fqemu.git serial-pci: remove memory regions from BAR before destroying them Otherwise, hot-unplug of pci-serial-2x trips the assertion in memory_region_destroy: (qemu) device_del gg (qemu) qemu-system-x86_64: /work/armbru/tmp/qemu/memory.c:1021: memory_region_destroy: Assertion `((&mr->subregions)->tqh_first == ((void *)0))' failed. Aborted (core dumped) Reported-by: Markus Armbruster Reviewed-by: Markus Armbruster Signed-off-by: Paolo Bonzini --- diff --git a/hw/char/serial-pci.c b/hw/char/serial-pci.c index f53bb9c5d0..c133c33e7a 100644 --- a/hw/char/serial-pci.c +++ b/hw/char/serial-pci.c @@ -148,6 +148,7 @@ static void multi_serial_pci_exit(PCIDevice *dev) for (i = 0; i < pci->ports; i++) { s = pci->state + i; serial_exit_core(s); + memory_region_del_subregion(&pci->iobar, &s->io); memory_region_destroy(&s->io); g_free(pci->name[i]); }