KVM Archive on lore.kernel.org
 help / color / Atom feed
* Re: [PATCH] KVM: arm64: get rid of var ret and out jump label in kvm_arch_vcpu_ioctl_set_guest_debug()
@ 2020-01-14  2:20 linmiaohe
  2020-01-15 13:58 ` Marc Zyngier
  0 siblings, 1 reply; 5+ messages in thread
From: linmiaohe @ 2020-01-14  2:20 UTC (permalink / raw)
  To: maz, pbonzini, rkrcmar, james.morse, julien.thierry.kdev,
	suzuki.poulose, christoffer.dall, catalin.marinas, eric.auger,
	gregkh, will, andre.przywara, tglx
  Cc: linmiaohe, linux-arm-kernel, kvmarm, linux-kernel, kvm

Friendly ping :)

> From: Miaohe Lin <linmiaohe@huawei.com>
>
> The var ret and out jump label is not really needed. Clean them up.
> Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
> ---
>  arch/arm64/kvm/guest.c | 11 +++--------
>  1 file changed, 3 insertions(+), 8 deletions(-)
>
> diff --git a/arch/arm64/kvm/guest.c b/arch/arm64/kvm/guest.c index 2fff06114a8f..3b836c91609e 100644
> --- a/arch/arm64/kvm/guest.c
> +++ b/arch/arm64/kvm/guest.c
> @@ -834,14 +834,10 @@ int kvm_arch_vcpu_ioctl_translate(struct kvm_vcpu *vcpu,  int kvm_arch_vcpu_ioctl_set_guest_debug(struct kvm_vcpu *vcpu,
>  					struct kvm_guest_debug *dbg)
>  {
> -	int ret = 0;
> -
>  	trace_kvm_set_guest_debug(vcpu, dbg->control);
>  
> -	if (dbg->control & ~KVM_GUESTDBG_VALID_MASK) {
> -		ret = -EINVAL;
> -		goto out;
> -	}
> +	if (dbg->control & ~KVM_GUESTDBG_VALID_MASK)
> +		return -EINVAL;
>  
>  	if (dbg->control & KVM_GUESTDBG_ENABLE) {
>  		vcpu->guest_debug = dbg->control;
> @@ -856,8 +852,7 @@ int kvm_arch_vcpu_ioctl_set_guest_debug(struct kvm_vcpu *vcpu,
>  		vcpu->guest_debug = 0;
>  	}
>  
> -out:
> -	return ret;
> +	return 0;
>  }
>  
>  int kvm_arm_vcpu_arch_set_attr(struct kvm_vcpu *vcpu,
> --
> 2.19.1
>

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

* Re: [PATCH] KVM: arm64: get rid of var ret and out jump label in kvm_arch_vcpu_ioctl_set_guest_debug()
  2020-01-14  2:20 [PATCH] KVM: arm64: get rid of var ret and out jump label in kvm_arch_vcpu_ioctl_set_guest_debug() linmiaohe
@ 2020-01-15 13:58 ` Marc Zyngier
  0 siblings, 0 replies; 5+ messages in thread
From: Marc Zyngier @ 2020-01-15 13:58 UTC (permalink / raw)
  To: linmiaohe
  Cc: pbonzini, rkrcmar, james.morse, julien.thierry.kdev,
	suzuki.poulose, christoffer.dall, catalin.marinas, eric.auger,
	gregkh, will, andre.przywara, tglx, linux-arm-kernel, kvmarm,
	linux-kernel, kvm

On 2020-01-14 02:20, linmiaohe wrote:
> Friendly ping :)

Friendly reply:

>> From: Miaohe Lin <linmiaohe@huawei.com>
>> 
>> The var ret and out jump label is not really needed. Clean them up.
>> Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
>> ---
>>  arch/arm64/kvm/guest.c | 11 +++--------
>>  1 file changed, 3 insertions(+), 8 deletions(-)
>> 
>> diff --git a/arch/arm64/kvm/guest.c b/arch/arm64/kvm/guest.c index 
>> 2fff06114a8f..3b836c91609e 100644
>> --- a/arch/arm64/kvm/guest.c
>> +++ b/arch/arm64/kvm/guest.c
>> @@ -834,14 +834,10 @@ int kvm_arch_vcpu_ioctl_translate(struct 
>> kvm_vcpu *vcpu,  int kvm_arch_vcpu_ioctl_set_guest_debug(struct 
>> kvm_vcpu *vcpu,
>>  					struct kvm_guest_debug *dbg)
>>  {
>> -	int ret = 0;
>> -
>>  	trace_kvm_set_guest_debug(vcpu, dbg->control);
>> 
>> -	if (dbg->control & ~KVM_GUESTDBG_VALID_MASK) {
>> -		ret = -EINVAL;
>> -		goto out;
>> -	}
>> +	if (dbg->control & ~KVM_GUESTDBG_VALID_MASK)
>> +		return -EINVAL;
>> 
>>  	if (dbg->control & KVM_GUESTDBG_ENABLE) {
>>  		vcpu->guest_debug = dbg->control;
>> @@ -856,8 +852,7 @@ int kvm_arch_vcpu_ioctl_set_guest_debug(struct 
>> kvm_vcpu *vcpu,
>>  		vcpu->guest_debug = 0;
>>  	}
>> 
>> -out:
>> -	return ret;
>> +	return 0;

I don't think there is anything wrong with the existing code.
It may not be to your own taste, but is in keeping with a lot
of the KVM code.

If you were making changes to this code, I wouldn't object.
But on its own, this is just churn.

Thanks,

         M.
-- 
Jazz is not dead. It just smells funny...

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

* Re: [PATCH] KVM: arm64: get rid of var ret and out jump label in kvm_arch_vcpu_ioctl_set_guest_debug()
@ 2020-01-16  2:03 linmiaohe
  0 siblings, 0 replies; 5+ messages in thread
From: linmiaohe @ 2020-01-16  2:03 UTC (permalink / raw)
  To: Marc Zyngier
  Cc: pbonzini, rkrcmar, james.morse, julien.thierry.kdev,
	suzuki.poulose, christoffer.dall, catalin.marinas, eric.auger,
	gregkh, will, andre.przywara, tglx, linux-arm-kernel, kvmarm,
	linux-kernel, kvm


Marc Zyngier <maz@kernel.org> wrote:
> 
> I don't think there is anything wrong with the existing code.
> It may not be to your own taste, but is in keeping with a lot of the KVM code.
>
> If you were making changes to this code, I wouldn't object.
> But on its own, this is just churn.
>
> Thanks,
>
>          M.

Oh, I see. Many thanks for your reply and patient explaination.

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

* Re: [PATCH] KVM: arm64: get rid of var ret and out jump label in kvm_arch_vcpu_ioctl_set_guest_debug()
  2019-11-28  3:09 linmiaohe
@ 2019-11-28  8:50 ` Auger Eric
  0 siblings, 0 replies; 5+ messages in thread
From: Auger Eric @ 2019-11-28  8:50 UTC (permalink / raw)
  To: linmiaohe, maz, pbonzini, rkrcmar, james.morse,
	julien.thierry.kdev, suzuki.poulose, christoffer.dall,
	catalin.marinas, gregkh, will, andre.przywara, tglx
  Cc: linux-arm-kernel, kvmarm, linux-kernel, kvm

Hi,

On 11/28/19 4:09 AM, linmiaohe wrote:
> From: Miaohe Lin <linmiaohe@huawei.com>
> 
> The var ret and out jump label is not really needed. Clean them
> up.
> Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
Reviewed-by: Eric Auger <eric.auger@redhat.com>

Thanks

Eric

> ---
>  arch/arm64/kvm/guest.c | 11 +++--------
>  1 file changed, 3 insertions(+), 8 deletions(-)
> 
> diff --git a/arch/arm64/kvm/guest.c b/arch/arm64/kvm/guest.c
> index 2fff06114a8f..3b836c91609e 100644
> --- a/arch/arm64/kvm/guest.c
> +++ b/arch/arm64/kvm/guest.c
> @@ -834,14 +834,10 @@ int kvm_arch_vcpu_ioctl_translate(struct kvm_vcpu *vcpu,
>  int kvm_arch_vcpu_ioctl_set_guest_debug(struct kvm_vcpu *vcpu,
>  					struct kvm_guest_debug *dbg)
>  {
> -	int ret = 0;
> -
>  	trace_kvm_set_guest_debug(vcpu, dbg->control);
>  
> -	if (dbg->control & ~KVM_GUESTDBG_VALID_MASK) {
> -		ret = -EINVAL;
> -		goto out;
> -	}
> +	if (dbg->control & ~KVM_GUESTDBG_VALID_MASK)
> +		return -EINVAL;
>  
>  	if (dbg->control & KVM_GUESTDBG_ENABLE) {
>  		vcpu->guest_debug = dbg->control;
> @@ -856,8 +852,7 @@ int kvm_arch_vcpu_ioctl_set_guest_debug(struct kvm_vcpu *vcpu,
>  		vcpu->guest_debug = 0;
>  	}
>  
> -out:
> -	return ret;
> +	return 0;
>  }
>  
>  int kvm_arm_vcpu_arch_set_attr(struct kvm_vcpu *vcpu,
> 


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

* [PATCH] KVM: arm64: get rid of var ret and out jump label in kvm_arch_vcpu_ioctl_set_guest_debug()
@ 2019-11-28  3:09 linmiaohe
  2019-11-28  8:50 ` Auger Eric
  0 siblings, 1 reply; 5+ messages in thread
From: linmiaohe @ 2019-11-28  3:09 UTC (permalink / raw)
  To: maz, pbonzini, rkrcmar, james.morse, julien.thierry.kdev,
	suzuki.poulose, christoffer.dall, catalin.marinas, eric.auger,
	gregkh, will, andre.przywara, tglx
  Cc: linmiaohe, linux-arm-kernel, kvmarm, linux-kernel, kvm

From: Miaohe Lin <linmiaohe@huawei.com>

The var ret and out jump label is not really needed. Clean them
up.
Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
---
 arch/arm64/kvm/guest.c | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/arch/arm64/kvm/guest.c b/arch/arm64/kvm/guest.c
index 2fff06114a8f..3b836c91609e 100644
--- a/arch/arm64/kvm/guest.c
+++ b/arch/arm64/kvm/guest.c
@@ -834,14 +834,10 @@ int kvm_arch_vcpu_ioctl_translate(struct kvm_vcpu *vcpu,
 int kvm_arch_vcpu_ioctl_set_guest_debug(struct kvm_vcpu *vcpu,
 					struct kvm_guest_debug *dbg)
 {
-	int ret = 0;
-
 	trace_kvm_set_guest_debug(vcpu, dbg->control);
 
-	if (dbg->control & ~KVM_GUESTDBG_VALID_MASK) {
-		ret = -EINVAL;
-		goto out;
-	}
+	if (dbg->control & ~KVM_GUESTDBG_VALID_MASK)
+		return -EINVAL;
 
 	if (dbg->control & KVM_GUESTDBG_ENABLE) {
 		vcpu->guest_debug = dbg->control;
@@ -856,8 +852,7 @@ int kvm_arch_vcpu_ioctl_set_guest_debug(struct kvm_vcpu *vcpu,
 		vcpu->guest_debug = 0;
 	}
 
-out:
-	return ret;
+	return 0;
 }
 
 int kvm_arm_vcpu_arch_set_attr(struct kvm_vcpu *vcpu,
-- 
2.19.1


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

end of thread, back to index

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-14  2:20 [PATCH] KVM: arm64: get rid of var ret and out jump label in kvm_arch_vcpu_ioctl_set_guest_debug() linmiaohe
2020-01-15 13:58 ` Marc Zyngier
  -- strict thread matches above, loose matches on Subject: below --
2020-01-16  2:03 linmiaohe
2019-11-28  3:09 linmiaohe
2019-11-28  8:50 ` Auger Eric

KVM Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/kvm/0 kvm/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 kvm kvm/ https://lore.kernel.org/kvm \
		kvm@vger.kernel.org
	public-inbox-index kvm

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.kvm


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git