Patchwork [3/7] msi: Guard msi_reset with msi_present

login
register
mail settings
Submitter Jan Kiszka
Date June 8, 2011, 10:26 a.m.
Message ID <9b6b208ed8dc424ba847707e9f5ef4ed95046b6f.1307528800.git.jan.kiszka@siemens.com>
Download mbox | patch
Permalink /patch/99404/
State New
Headers show

Comments

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

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;