[PATCH 07/13] pci-assign: Fix kvm_deassign_irq handling in assign_irq

Jan Kiszka
2011-06-27T18:20:41Z

From: Jan Kiszka <jan.kiszka@siemens.com>

Always clear AssignedDevice::irq_requested_type after calling
kvm_deassign_irq. Moreover, drop the obviously incorrect exclusion when
reporting related errors - if irq_requested_type is non-zero, deassign
must not fail.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
hw/device-assignment.c | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/hw/device-assignment.c b/hw/device-assignment.c
index 36ad6b0..36c0f5f 100644
--- a/hw/device-assignment.c
+++ b/hw/device-assignment.c
@@ -992,9 +992,10 @@ static int assign_irq(AssignedDevice *dev)
if (dev->irq_requested_type) {
assigned_irq_data.flags = dev->irq_requested_type;
r = kvm_deassign_irq(kvm_state, &assigned_irq_data);
- /* -ENXIO means no assigned irq */
- if (r && r != -ENXIO)
+ if (r) {
perror("assign_irq: deassign");
+ }
+ dev->irq_requested_type = 0;
}

assigned_irq_data.flags = KVM_DEV_IRQ_GUEST_INTX;
--
1.7.1