* [PATCH] KVM: x86: drop unneeded null test
@ 2015-04-27 20:35 ` Julia Lawall
0 siblings, 0 replies; 8+ messages in thread
From: Julia Lawall @ 2015-04-27 20:35 UTC (permalink / raw)
To: Gleb Natapov, Michael S . Tsirkin, zhanghy, jasowang
Cc: kernel-janitors, Paolo Bonzini, Thomas Gleixner, Ingo Molnar,
H. Peter Anvin, x86, kvm, linux-kernel
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>
---
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)
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH] KVM: x86: drop unneeded null test
@ 2015-04-27 20:35 ` Julia Lawall
0 siblings, 0 replies; 8+ messages in thread
From: Julia Lawall @ 2015-04-27 20:35 UTC (permalink / raw)
To: Gleb Natapov, Michael S . Tsirkin, zhanghy, jasowang
Cc: kernel-janitors, Paolo Bonzini, Thomas Gleixner, Ingo Molnar,
H. Peter Anvin, x86, kvm, linux-kernel
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>
---
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)
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH] KVM: x86: drop unneeded null test
2015-04-27 20:35 ` Julia Lawall
@ 2015-04-27 20:50 ` Michael S. Tsirkin
-1 siblings, 0 replies; 8+ messages in thread
From: Michael S. Tsirkin @ 2015-04-27 20:50 UTC (permalink / raw)
To: Julia Lawall
Cc: Gleb Natapov, zhanghy, jasowang, kernel-janitors, Paolo Bonzini,
Thomas Gleixner, Ingo Molnar, H. Peter Anvin, x86, kvm,
linux-kernel
On Mon, Apr 27, 2015 at 10:35:34PM +0200, 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>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
>
> ---
> 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)
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] KVM: x86: drop unneeded null test
@ 2015-04-27 20:50 ` Michael S. Tsirkin
0 siblings, 0 replies; 8+ messages in thread
From: Michael S. Tsirkin @ 2015-04-27 20:50 UTC (permalink / raw)
To: Julia Lawall
Cc: Gleb Natapov, zhanghy, jasowang, kernel-janitors, Paolo Bonzini,
Thomas Gleixner, Ingo Molnar, H. Peter Anvin, x86, kvm,
linux-kernel
On Mon, Apr 27, 2015 at 10:35:34PM +0200, 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>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
>
> ---
> 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)
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] KVM: x86: drop unneeded null test
2015-04-27 20:35 ` Julia Lawall
@ 2015-04-28 9:57 ` Paolo Bonzini
-1 siblings, 0 replies; 8+ messages in thread
From: Paolo Bonzini @ 2015-04-28 9:57 UTC (permalink / raw)
To: Julia Lawall, Gleb Natapov, Michael S . Tsirkin, zhanghy,
jasowang
Cc: kernel-janitors, Thomas Gleixner, Ingo Molnar, H. Peter Anvin,
x86, kvm, linux-kernel
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)
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] KVM: x86: drop unneeded null test
@ 2015-04-28 9:57 ` Paolo Bonzini
0 siblings, 0 replies; 8+ messages in thread
From: Paolo Bonzini @ 2015-04-28 9:57 UTC (permalink / raw)
To: Julia Lawall, Gleb Natapov, Michael S . Tsirkin, zhanghy,
jasowang
Cc: kernel-janitors, Thomas Gleixner, Ingo Molnar, H. Peter Anvin,
x86, kvm, linux-kernel
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)
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] KVM: x86: drop unneeded null test
2015-04-27 20:35 ` Julia Lawall
@ 2015-04-28 17:21 ` SF Markus Elfring
-1 siblings, 0 replies; 8+ messages in thread
From: SF Markus Elfring @ 2015-04-28 17:21 UTC (permalink / raw)
To: Julia Lawall
Cc: Gleb Natapov, Michael S . Tsirkin, zhanghy, jasowang,
kernel-janitors, Paolo Bonzini, Thomas Gleixner, Ingo Molnar,
H. Peter Anvin, x86, kvm, linux-kernel
> 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.
Does your commit message need a small fix?
Regards,
Markus
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] KVM: x86: drop unneeded null test
@ 2015-04-28 17:21 ` SF Markus Elfring
0 siblings, 0 replies; 8+ messages in thread
From: SF Markus Elfring @ 2015-04-28 17:21 UTC (permalink / raw)
To: Julia Lawall
Cc: Gleb Natapov, Michael S . Tsirkin, zhanghy, jasowang,
kernel-janitors, Paolo Bonzini, Thomas Gleixner, Ingo Molnar,
H. Peter Anvin, x86, kvm, linux-kernel
> 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.
Does your commit message need a small fix?
Regards,
Markus
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2015-04-28 17:21 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2015-04-28 9:57 ` Paolo Bonzini
2015-04-28 17:21 ` SF Markus Elfring
2015-04-28 17:21 ` SF Markus Elfring
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.