[3/7] msi: Guard msi_reset with msi_present

Submitted by Jan Kiszka on June 8, 2011, 10:26 a.m.

Details

Message ID 9b6b208ed8dc424ba847707e9f5ef4ed95046b6f.1307528800.git.jan.kiszka@siemens.com
State New
Headers show

Commit Message

Jan Kiszka June 8, 2011, 10:26 a.m.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
 hw/msi.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

Patch hide | download patch | download mbox

diff --git a/hw/msi.c b/hw/msi.c
index b7a92c9..b039893 100644
--- a/hw/msi.c
+++ b/hw/msi.c
@@ -183,6 +183,10 @@  void msi_reset(PCIDevice *dev)
     uint16_t flags;
     bool msi64bit;
 
+    if (!msi_present(dev)) {
+        return;
+    }
+
     flags = pci_get_word(dev->config + msi_flags_off(dev));
     flags &= ~(PCI_MSI_FLAGS_QSIZE | PCI_MSI_FLAGS_ENABLE);
     msi64bit = flags & PCI_MSI_FLAGS_64BIT;