aboutsummaryrefslogtreecommitdiffstats
path: root/virt
diff options
context:
space:
mode:
Diffstat (limited to 'virt')
-rw-r--r--virt/kvm/irq_comm.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/virt/kvm/irq_comm.c b/virt/kvm/irq_comm.c
index 15a83b93566d..00c68d298579 100644
--- a/virt/kvm/irq_comm.c
+++ b/virt/kvm/irq_comm.c
@@ -220,11 +220,13 @@ int kvm_request_irq_source_id(struct kvm *kvm)
220 220
221 if (irq_source_id >= sizeof(kvm->arch.irq_sources_bitmap)) { 221 if (irq_source_id >= sizeof(kvm->arch.irq_sources_bitmap)) {
222 printk(KERN_WARNING "kvm: exhaust allocatable IRQ sources!\n"); 222 printk(KERN_WARNING "kvm: exhaust allocatable IRQ sources!\n");
223 return -EFAULT; 223 irq_source_id = -EFAULT;
224 goto unlock;
224 } 225 }
225 226
226 ASSERT(irq_source_id != KVM_USERSPACE_IRQ_SOURCE_ID); 227 ASSERT(irq_source_id != KVM_USERSPACE_IRQ_SOURCE_ID);
227 set_bit(irq_source_id, bitmap); 228 set_bit(irq_source_id, bitmap);
229unlock:
228 mutex_unlock(&kvm->irq_lock); 230 mutex_unlock(&kvm->irq_lock);
229 231
230 return irq_source_id; 232 return irq_source_id;
@@ -240,7 +242,7 @@ void kvm_free_irq_source_id(struct kvm *kvm, int irq_source_id)
240 if (irq_source_id < 0 || 242 if (irq_source_id < 0 ||
241 irq_source_id >= sizeof(kvm->arch.irq_sources_bitmap)) { 243 irq_source_id >= sizeof(kvm->arch.irq_sources_bitmap)) {
242 printk(KERN_ERR "kvm: IRQ source ID out of range!\n"); 244 printk(KERN_ERR "kvm: IRQ source ID out of range!\n");
243 return; 245 goto unlock;
244 } 246 }
245 for (i = 0; i < KVM_IOAPIC_NUM_PINS; i++) { 247 for (i = 0; i < KVM_IOAPIC_NUM_PINS; i++) {
246 clear_bit(irq_source_id, &kvm->arch.vioapic->irq_states[i]); 248 clear_bit(irq_source_id, &kvm->arch.vioapic->irq_states[i]);
@@ -251,6 +253,7 @@ void kvm_free_irq_source_id(struct kvm *kvm, int irq_source_id)
251#endif 253#endif
252 } 254 }
253 clear_bit(irq_source_id, &kvm->arch.irq_sources_bitmap); 255 clear_bit(irq_source_id, &kvm->arch.irq_sources_bitmap);
256unlock:
254 mutex_unlock(&kvm->irq_lock); 257 mutex_unlock(&kvm->irq_lock);
255} 258}
256 259