From: Julia Lawall Date: Mon, 27 Apr 2015 20:35:34 +0000 (+0200) Subject: KVM: x86: drop unneeded null test X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=d90e3a35e90af7f8beceebefc90e62eae237c5ed;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git KVM: x86: drop unneeded null test If the null test is needed, the call to cancel_delayed_work_sync would have already crashed. Normally, the destroy function should only be called if the init function has succeeded, in which case ioapic is not null. Problem found using Coccinelle. Suggested-by: Michael S. Tsirkin Signed-off-by: Julia Lawall Signed-off-by: Paolo Bonzini --- diff --git a/arch/x86/kvm/ioapic.c b/arch/x86/kvm/ioapic.c index 274663496f7a..856f79105bb5 100644 --- a/arch/x86/kvm/ioapic.c +++ b/arch/x86/kvm/ioapic.c @@ -638,11 +638,9 @@ void kvm_ioapic_destroy(struct kvm *kvm) struct kvm_ioapic *ioapic = kvm->arch.vioapic; cancel_delayed_work_sync(&ioapic->eoi_inject); - if (ioapic) { - kvm_io_bus_unregister_dev(kvm, KVM_MMIO_BUS, &ioapic->dev); - kvm->arch.vioapic = NULL; - kfree(ioapic); - } + kvm_io_bus_unregister_dev(kvm, KVM_MMIO_BUS, &ioapic->dev); + kvm->arch.vioapic = NULL; + kfree(ioapic); } int kvm_get_ioapic(struct kvm *kvm, struct kvm_ioapic_state *state)