summaryrefslogtreecommitdiffstats
path: root/arch/x86/kvm/i8259.c
diff options
context:
space:
mode:
authorPeter Xu <peterx@redhat.com>2017-03-15 09:01:18 +0100
committerPaolo Bonzini <pbonzini@redhat.com>2017-03-23 19:02:03 +0100
commit950712eb8ef03e4a62ac5b3067efde7ec2f8a91e (patch)
treebbc3b0839d6f86d70cd604e9e057ed67dddfa059 /arch/x86/kvm/i8259.c
parentKVM: x86: clear bus pointer when destroyed (diff)
downloadlinux-950712eb8ef03e4a62ac5b3067efde7ec2f8a91e.tar.xz
linux-950712eb8ef03e4a62ac5b3067efde7ec2f8a91e.zip
KVM: x86: check existance before destroy
Mostly used for split irqchip mode. In that case, these two things are not inited at all, so no need to release. Signed-off-by: Peter Xu <peterx@redhat.com> Signed-off-by: Radim Krčmář <rkrcmar@redhat.com>
Diffstat (limited to 'arch/x86/kvm/i8259.c')
-rw-r--r--arch/x86/kvm/i8259.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/arch/x86/kvm/i8259.c b/arch/x86/kvm/i8259.c
index 73ea24d4f119..047b17a26269 100644
--- a/arch/x86/kvm/i8259.c
+++ b/arch/x86/kvm/i8259.c
@@ -657,6 +657,9 @@ void kvm_pic_destroy(struct kvm *kvm)
{
struct kvm_pic *vpic = kvm->arch.vpic;
+ if (!vpic)
+ return;
+
kvm_io_bus_unregister_dev(vpic->kvm, KVM_PIO_BUS, &vpic->dev_master);
kvm_io_bus_unregister_dev(vpic->kvm, KVM_PIO_BUS, &vpic->dev_slave);
kvm_io_bus_unregister_dev(vpic->kvm, KVM_PIO_BUS, &vpic->dev_eclr);