From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752278AbbDZRUC (ORCPT ); Sun, 26 Apr 2015 13:20:02 -0400 Received: from mail2-relais-roc.national.inria.fr ([192.134.164.83]:34414 "EHLO mail2-relais-roc.national.inria.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750812AbbDZRUA (ORCPT ); Sun, 26 Apr 2015 13:20:00 -0400 X-IronPort-AV: E=Sophos;i="5.11,652,1422918000"; d="scan'208";a="136803984" Date: Sun, 26 Apr 2015 19:19:58 +0200 (CEST) From: Julia Lawall X-X-Sender: jll@localhost6.localdomain6 To: zhanghy@sangfor.com, mst@redhat.com, jasowang@redhat.com, zhanghy@sangfor.com, pbonzini@redhat.com, x86@kernel.org, kvm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: KVM: x86: question about kvm_ioapic_destroy Message-ID: User-Agent: Alpine 2.02 (DEB 1266 2009-07-14) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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