Re: [PATCH v2 2/3] KVM: x86: check existance before destroy

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 15.03.2017 09:01, Peter Xu wrote:
> 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@xxxxxxxxxx>
> ---
>  arch/x86/kvm/i8259.c  | 3 +++
>  arch/x86/kvm/ioapic.c | 3 +++
>  2 files changed, 6 insertions(+)
> 
> diff --git a/arch/x86/kvm/i8259.c b/arch/x86/kvm/i8259.c
> index 73ea24d..047b17a 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);
> diff --git a/arch/x86/kvm/ioapic.c b/arch/x86/kvm/ioapic.c
> index 6e219e5..289270a 100644
> --- a/arch/x86/kvm/ioapic.c
> +++ b/arch/x86/kvm/ioapic.c
> @@ -635,6 +635,9 @@ void kvm_ioapic_destroy(struct kvm *kvm)
>  {
>  	struct kvm_ioapic *ioapic = kvm->arch.vioapic;
>  
> +	if (!ioapic)
> +		return;
> +
>  	cancel_delayed_work_sync(&ioapic->eoi_inject);
>  	kvm_io_bus_unregister_dev(kvm, KVM_MMIO_BUS, &ioapic->dev);
>  	kvm->arch.vioapic = NULL;
> 

Reviewed-by: David Hildenbrand <david@xxxxxxxxxx>

-- 

Thanks,

David



[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux