MSI: Robust resource release

msi_init may fail, so we need to check on uninit if the cap was
actually installed. This also avoids that the users need to check.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
This commit is contained in:
Jan Kiszka 2011-05-02 20:00:47 +02:00 committed by Michael S. Tsirkin
parent 072476ea08
commit 45fe15c25a
3 changed files with 12 additions and 9 deletions

View file

@ -1165,9 +1165,7 @@ static int intel_hda_exit(PCIDevice *pci)
{
IntelHDAState *d = DO_UPCAST(IntelHDAState, pci, pci);
if (d->msi) {
msi_uninit(&d->pci);
}
msi_uninit(&d->pci);
cpu_unregister_io_memory(d->mmio_addr);
return 0;
}