From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Michael S. Tsirkin" Subject: Re: KVM: x86: question about kvm_ioapic_destroy Date: Mon, 27 Apr 2015 12:05:33 +0200 Message-ID: <20150427120342-mutt-send-email-mst@redhat.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: zhanghy@sangfor.com, jasowang@redhat.com, pbonzini@redhat.com, x86@kernel.org, kvm@vger.kernel.org, linux-kernel@vger.kernel.org To: Julia Lawall Return-path: Received: from mx1.redhat.com ([209.132.183.28]:34958 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932435AbbD0KFq (ORCPT ); Mon, 27 Apr 2015 06:05:46 -0400 Content-Disposition: inline In-Reply-To: Sender: kvm-owner@vger.kernel.org List-ID: On Sun, Apr 26, 2015 at 07:19:58PM +0200, Julia Lawall wrote: > The function kvm_ioapic_destroy is defined as follows: > > 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); > } > } > > Is there any way that cancel_delayed_work_sync can work if ioapic is NULL? > Should the call be moved down under the NULL test? Or is the NULL test > not needed? The NULL test has been there longer than the call to > cancel_delayed_work_sync, which was introduced in 184564ef. > > thanks, > julia I think the NULL test is not needed. kvm_ioapic_destroy is only called if kvm_ioapic_init completed successfully, and that sets kvm->arch.vioapic. -- MST