2019-11-28 03:11:25

by Miaohe Lin

[permalink] [raw]
Subject: [PATCH] KVM: arm64: get rid of var ret and out jump label in kvm_arch_vcpu_ioctl_set_guest_debug()

From: Miaohe Lin <[email protected]>

The var ret and out jump label is not really needed. Clean them
up.
Signed-off-by: Miaohe Lin <[email protected]>
---
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


2019-11-28 09:56:44

by Eric Auger

[permalink] [raw]
Subject: Re: [PATCH] KVM: arm64: get rid of var ret and out jump label in kvm_arch_vcpu_ioctl_set_guest_debug()

Hi,

On 11/28/19 4:09 AM, linmiaohe wrote:
> From: Miaohe Lin <[email protected]>
>
> The var ret and out jump label is not really needed. Clean them
> up.
> Signed-off-by: Miaohe Lin <[email protected]>
Reviewed-by: Eric Auger <[email protected]>

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

2020-01-14 02:41:38

by Miaohe Lin

[permalink] [raw]
Subject: Re: [PATCH] KVM: arm64: get rid of var ret and out jump label in kvm_arch_vcpu_ioctl_set_guest_debug()

Friendly ping :)

> From: Miaohe Lin <[email protected]>
>
> The var ret and out jump label is not really needed. Clean them up.
> Signed-off-by: Miaohe Lin <[email protected]>
> ---
> 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
>

2020-01-15 14:01:00

by Marc Zyngier

[permalink] [raw]
Subject: Re: [PATCH] KVM: arm64: get rid of var ret and out jump label in kvm_arch_vcpu_ioctl_set_guest_debug()

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

Friendly reply:

>> From: Miaohe Lin <[email protected]>
>>
>> The var ret and out jump label is not really needed. Clean them up.
>> Signed-off-by: Miaohe Lin <[email protected]>
>> ---
>> 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...

2020-01-16 03:06:35

by Miaohe Lin

[permalink] [raw]
Subject: Re: [PATCH] KVM: arm64: get rid of var ret and out jump label in kvm_arch_vcpu_ioctl_set_guest_debug()


Marc Zyngier <[email protected]> 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.