All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Julia Lawall <Julia.Lawall@lip6.fr>,
	Gleb Natapov <gleb@kernel.org>,
	"Michael S . Tsirkin" <mst@redhat.com>,
	zhanghy@sangfor.com, jasowang@redhat.com
Cc: kernel-janitors@vger.kernel.org,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, "H. Peter Anvin" <hpa@zytor.com>,
	x86@kernel.org, kvm@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] KVM: x86: drop unneeded null test
Date: Tue, 28 Apr 2015 09:57:22 +0000	[thread overview]
Message-ID: <553F5982.4010405@redhat.com> (raw)
In-Reply-To: <1430166934-30834-1-git-send-email-Julia.Lawall@lip6.fr>



On 27/04/2015 22:35, Julia Lawall wrote:
> From: Julia Lawall <Julia.Lawall@lip6.fr>
> 
> 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 <Julia.Lawall@lip6.fr>

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)
> 

WARNING: multiple messages have this Message-ID (diff)
From: Paolo Bonzini <pbonzini@redhat.com>
To: Julia Lawall <Julia.Lawall@lip6.fr>,
	Gleb Natapov <gleb@kernel.org>,
	"Michael S . Tsirkin" <mst@redhat.com>,
	zhanghy@sangfor.com, jasowang@redhat.com
Cc: kernel-janitors@vger.kernel.org,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, "H. Peter Anvin" <hpa@zytor.com>,
	x86@kernel.org, kvm@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] KVM: x86: drop unneeded null test
Date: Tue, 28 Apr 2015 11:57:22 +0200	[thread overview]
Message-ID: <553F5982.4010405@redhat.com> (raw)
In-Reply-To: <1430166934-30834-1-git-send-email-Julia.Lawall@lip6.fr>



On 27/04/2015 22:35, Julia Lawall wrote:
> From: Julia Lawall <Julia.Lawall@lip6.fr>
> 
> 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 <Julia.Lawall@lip6.fr>

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)
> 

  parent reply	other threads:[~2015-04-28  9:57 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-27 20:35 [PATCH] KVM: x86: drop unneeded null test Julia Lawall
2015-04-27 20:35 ` Julia Lawall
2015-04-27 20:50 ` Michael S. Tsirkin
2015-04-27 20:50   ` Michael S. Tsirkin
2015-04-28  9:57 ` Paolo Bonzini [this message]
2015-04-28  9:57   ` Paolo Bonzini
2015-04-28 17:21 ` SF Markus Elfring
2015-04-28 17:21   ` SF Markus Elfring

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=553F5982.4010405@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=Julia.Lawall@lip6.fr \
    --cc=gleb@kernel.org \
    --cc=hpa@zytor.com \
    --cc=jasowang@redhat.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=mst@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    --cc=zhanghy@sangfor.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.