lsilogic: Use PCIDevice::exit instead of DeviceState::unrealize
commitfaabca42cc4ff51110116dfe44d420c668b4d8d8
authorPeng Liang <liangpeng10@huawei.com>
Tue, 2 Mar 2021 13:30:16 +0000 (2 21:30 +0800)
committerPaolo Bonzini <pbonzini@redhat.com>
Sat, 6 Mar 2021 10:41:54 +0000 (6 11:41 +0100)
tree4002b785ada57f8e4d20388ed277b9e189a1c143
parent3920552846e881bafa9f9aad0bb1a6eef874d7fb
lsilogic: Use PCIDevice::exit instead of DeviceState::unrealize

PCI_DEVICE has overwritten DeviceState::unrealize (pci_qdev_unrealize).
However, LSI53C895A, which is a subclass of PCI_DEVICE, overwrites it
again and doesn't save the parent's implementation so the PCI_DEVICE's
implementation of DeviceState::unrealize will never be called when
unrealize a LSI53C895A device.  And it will lead to memory leak and
unplug failure.

For a PCI device, it's better to implement PCIDevice::exit instead of
DeviceState::unrealize.  So let's change to use PCIDevice::exit.

Fixes: a8632434c7e9 ("lsi: implement I/O memory space for Memory Move instructions")
Cc: qemu-stable@nongnu.org
Signed-off-by: Peng Liang <liangpeng10@huawei.com>
Message-Id: <20210302133016.1221081-1-liangpeng10@huawei.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
hw/scsi/lsi53c895a.c