Patchwork [v2,3/9] msi: Guard msi_reset with msi_present

login
register
mail settings
Submitter Jan Kiszka
Date June 8, 2011, 4:21 p.m.
Message ID <134c6ed38c0ce2ad5b9c94ab3033b932bc202673.1307550106.git.jan.kiszka@siemens.com>
Download mbox | patch
Permalink /patch/99504/
State New
Headers show

Comments

Jan Kiszka - June 8, 2011, 4:21 p.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;