[PATCH v2] kvm: device-assignment: Fix kvm_get_irq_route_gsi() return check

Alex Williamson
2009-05-13T04:45:05Z

Use 'r' for the return value since gsi is unsigned.

Signed-off-by: Alex Williamson <alex.williamson@hp.com>
---

v2: Use 'r' instead of a cast, per Sheng Yang

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 a6cc9b9..4107915 100644
--- a/hw/device-assignment.c
+++ b/hw/device-assignment.c
@@ -797,11 +797,12 @@ static void assigned_dev_update_msi(PCIDevice *pci_dev, unsigned int ctrl_pos)
assigned_dev->entry->u.msi.data = *(uint16_t *)(pci_dev->config +
pci_dev->cap.start + PCI_MSI_DATA_32);
assigned_dev->entry->type = KVM_IRQ_ROUTING_MSI;
- assigned_dev->entry->gsi = kvm_get_irq_route_gsi(kvm_context);
- if (assigned_dev->entry->gsi < 0) {
+ r = kvm_get_irq_route_gsi(kvm_context);
+ if (r < 0) {
perror("assigned_dev_update_msi: kvm_get_irq_route_gsi");
return;
}
+ assigned_dev->entry->gsi = r;

kvm_add_routing_entry(kvm_context, assigned_dev->entry);
if (kvm_commit_irq_routes(kvm_context) < 0) {