Skip to contentSkip to conversation

kvm: fix error handling for out of range irq

PATCH Applied Michael S. Tsirkin 2 participants 2 messages Jan 18, 2012 – Jan 19, 2012 KVM

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kvm: fix error handling for out of range irq

find_index_from_host_irq returns 0 on error
but callers assume < 0 on error. This should
not matter much: an out of range irq should never happen since irq handler was registered with this irq #,
and even if it does we get a spurious msix irq in guest and typically nothing terrible happens.

Still, better to make it consistent.

---
 virt/kvm/assigned-dev.c |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)
virt/kvm/assigned-dev.c +1 -3
index 73bb001..0cbd8a1 100644
@@ -49,10 +49,8 @@ static int find_index_from_host_irq(struct kvm_assigned_dev_kernel
 			index = i;
 			break;
 		}
-	if (index < 0) {
+	if (index < 0)
 		printk(KERN_WARNING "Fail to find correlated MSI-X entry!\n");
-		return 0;
-	}
 
 	return index;
 }
Signature · 1 line
1.7.8.2.325.g247f9
#1 lore raw
Quoted 7 lines · Michael S. Tsirkin

find_index_from_host_irq returns 0 on error
but callers assume < 0 on error. This should
not matter much: an out of range irq should never happen since irq handler was registered with this irq #,
and even if it does we get a spurious msix irq in guest and typically nothing terrible happens.

Quoted 6 lines

Still, better to make it consistent.

---
 virt/kvm/assigned-dev.c |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)

Applied, thanks.