From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933176AbbD1J5e (ORCPT ); Tue, 28 Apr 2015 05:57:34 -0400 Received: from mx1.redhat.com ([209.132.183.28]:58543 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751766AbbD1J5c (ORCPT ); Tue, 28 Apr 2015 05:57:32 -0400 Message-ID: <553F5982.4010405@redhat.com> Date: Tue, 28 Apr 2015 11:57:22 +0200 From: Paolo Bonzini User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 MIME-Version: 1.0 To: Julia Lawall , Gleb Natapov , "Michael S . Tsirkin" , zhanghy@sangfor.com, jasowang@redhat.com CC: kernel-janitors@vger.kernel.org, Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , x86@kernel.org, kvm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] KVM: x86: drop unneeded null test References: <1430166934-30834-1-git-send-email-Julia.Lawall@lip6.fr> In-Reply-To: <1430166934-30834-1-git-send-email-Julia.Lawall@lip6.fr> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 27/04/2015 22:35, Julia Lawall wrote: > From: Julia Lawall > > 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 functoin has succeeded, in which case ioapic is not null. > > Problem found using Coccinelle. > > Signed-off-by: Julia Lawall Applied, thanks. Paolo > --- > arch/x86/kvm/ioapic.c | 8 +++----- > 1 file changed, 3 insertions(+), 5 deletions(-) > > diff --git a/arch/x86/kvm/ioapic.c b2/arch/x86/kvm/ioapic.c > index 28146f0..09828e2 100644 > --- a/arch/x86/kvm/ioapic.c > +++ b2/arch/x86/kvm/ioapic.c > @@ -637,11 +637,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) >