public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] KVM: VMX: Add missing braces to avoid redundant error check
@ 2013-04-08  9:07 Jan Kiszka
  2013-04-08  9:47 ` Gleb Natapov
  0 siblings, 1 reply; 3+ messages in thread
From: Jan Kiszka @ 2013-04-08  9:07 UTC (permalink / raw)
  To: Gleb Natapov, Marcelo Tosatti; +Cc: kvm, Wu, Fengguang

The code was already properly aligned, now also add the braces to avoid
that err is checked even if alloc_apic_access_page didn't run and change
it. Found via Coccinelle by Fengguang Wu.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
 arch/x86/kvm/vmx.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index cf1aa8f..656b0fa 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -6797,10 +6797,11 @@ static struct kvm_vcpu *vmx_create_vcpu(struct kvm *kvm, unsigned int id)
 	put_cpu();
 	if (err)
 		goto free_vmcs;
-	if (vm_need_virtualize_apic_accesses(kvm))
+	if (vm_need_virtualize_apic_accesses(kvm)) {
 		err = alloc_apic_access_page(kvm);
 		if (err)
 			goto free_vmcs;
+	}
 
 	if (enable_ept) {
 		if (!kvm->arch.ept_identity_map_addr)
-- 
1.7.3.4

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] KVM: VMX: Add missing braces to avoid redundant error check
  2013-04-08  9:07 [PATCH] KVM: VMX: Add missing braces to avoid redundant error check Jan Kiszka
@ 2013-04-08  9:47 ` Gleb Natapov
  2013-04-08 10:28   ` Jan Kiszka
  0 siblings, 1 reply; 3+ messages in thread
From: Gleb Natapov @ 2013-04-08  9:47 UTC (permalink / raw)
  To: Jan Kiszka; +Cc: Marcelo Tosatti, kvm, Wu, Fengguang

On Mon, Apr 08, 2013 at 11:07:46AM +0200, Jan Kiszka wrote:
> The code was already properly aligned, now also add the braces to avoid
Are you saying kvm is not written in Python?

> that err is checked even if alloc_apic_access_page didn't run and change
> it. Found via Coccinelle by Fengguang Wu.
> 
> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Applied, thanks.

> ---
>  arch/x86/kvm/vmx.c |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
> 
> diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
> index cf1aa8f..656b0fa 100644
> --- a/arch/x86/kvm/vmx.c
> +++ b/arch/x86/kvm/vmx.c
> @@ -6797,10 +6797,11 @@ static struct kvm_vcpu *vmx_create_vcpu(struct kvm *kvm, unsigned int id)
>  	put_cpu();
>  	if (err)
>  		goto free_vmcs;
> -	if (vm_need_virtualize_apic_accesses(kvm))
> +	if (vm_need_virtualize_apic_accesses(kvm)) {
>  		err = alloc_apic_access_page(kvm);
>  		if (err)
>  			goto free_vmcs;
> +	}
>  
>  	if (enable_ept) {
>  		if (!kvm->arch.ept_identity_map_addr)
> -- 
> 1.7.3.4

--
			Gleb.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] KVM: VMX: Add missing braces to avoid redundant error check
  2013-04-08  9:47 ` Gleb Natapov
@ 2013-04-08 10:28   ` Jan Kiszka
  0 siblings, 0 replies; 3+ messages in thread
From: Jan Kiszka @ 2013-04-08 10:28 UTC (permalink / raw)
  To: Gleb Natapov; +Cc: Marcelo Tosatti, kvm, Wu, Fengguang

On 2013-04-08 11:47, Gleb Natapov wrote:
> On Mon, Apr 08, 2013 at 11:07:46AM +0200, Jan Kiszka wrote:
>> The code was already properly aligned, now also add the braces to avoid
> Are you saying kvm is not written in Python?

# python arch/x86/kvm/vmx.c
  File "arch/x86/kvm/vmx.c", line 1
    /*
    ^
SyntaxError: invalid syntax


Hmm, indeed. That explains our problems...

Jan

> 
>> that err is checked even if alloc_apic_access_page didn't run and change
>> it. Found via Coccinelle by Fengguang Wu.
>>
>> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
> Applied, thanks.
> 
>> ---
>>  arch/x86/kvm/vmx.c |    3 ++-
>>  1 files changed, 2 insertions(+), 1 deletions(-)
>>
>> diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
>> index cf1aa8f..656b0fa 100644
>> --- a/arch/x86/kvm/vmx.c
>> +++ b/arch/x86/kvm/vmx.c
>> @@ -6797,10 +6797,11 @@ static struct kvm_vcpu *vmx_create_vcpu(struct kvm *kvm, unsigned int id)
>>  	put_cpu();
>>  	if (err)
>>  		goto free_vmcs;
>> -	if (vm_need_virtualize_apic_accesses(kvm))
>> +	if (vm_need_virtualize_apic_accesses(kvm)) {
>>  		err = alloc_apic_access_page(kvm);
>>  		if (err)
>>  			goto free_vmcs;
>> +	}
>>  
>>  	if (enable_ept) {
>>  		if (!kvm->arch.ept_identity_map_addr)
>> -- 
>> 1.7.3.4
> 
> --
> 			Gleb.
> 

-- 
Siemens AG, Corporate Technology, CT RTC ITP SDP-DE
Corporate Competence Center Embedded Linux

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-04-08 10:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-08  9:07 [PATCH] KVM: VMX: Add missing braces to avoid redundant error check Jan Kiszka
2013-04-08  9:47 ` Gleb Natapov
2013-04-08 10:28   ` Jan Kiszka

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox