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>
diff --git a/hw/intel-hda.c b/hw/intel-hda.c
index 7f83745..5485745 100644
--- a/hw/intel-hda.c
+++ b/hw/intel-hda.c
@@ -1165,9 +1165,7 @@
{
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;
}