From 7e68ad18f5642e87a5970b0f45fc0d8c0ed22fd9 Mon Sep 17 00:00:00 2001 From: Bernhard Beschow Date: Thu, 5 Mar 2026 23:08:59 +0100 Subject: [PATCH] hw/char/{diva-gsp, serial-pci-multi}: Fix deinitialization order MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The memory region is owned by the device being unrealized, so must be removed from the mapping before unrealizing. Fixes: d66bbea4e0d3 ("serial: add 2x + 4x pci variant") Fixes: 274074708455 ("hw/char: Add emulation of Diva GSP PCI management boards") Reported-by: Peter Maydell Signed-off-by: Bernhard Beschow Message-ID: <20260305220911.131508-3-shentey@gmail.com> Signed-off-by: Philippe Mathieu-Daudé --- hw/char/diva-gsp.c | 2 +- hw/char/serial-pci-multi.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/char/diva-gsp.c b/hw/char/diva-gsp.c index 280d0413c6..f9aa6e326d 100644 --- a/hw/char/diva-gsp.c +++ b/hw/char/diva-gsp.c @@ -62,8 +62,8 @@ static void diva_pci_exit(PCIDevice *dev) for (i = 0; i < pci->ports; i++) { s = pci->state + i; - qdev_unrealize(DEVICE(s)); memory_region_del_subregion(&pci->membar, &s->io); + qdev_unrealize(DEVICE(s)); g_free(pci->name[i]); } qemu_free_irqs(pci->irqs, pci->ports); diff --git a/hw/char/serial-pci-multi.c b/hw/char/serial-pci-multi.c index 17796b93dd..7782452018 100644 --- a/hw/char/serial-pci-multi.c +++ b/hw/char/serial-pci-multi.c @@ -56,8 +56,8 @@ static void multi_serial_pci_exit(PCIDevice *dev) for (i = 0; i < pci->ports; i++) { s = pci->state + i; - qdev_unrealize(DEVICE(s)); memory_region_del_subregion(&pci->iobar, &s->io); + qdev_unrealize(DEVICE(s)); g_free(pci->name[i]); } }