2019-12-05 02:25:37

by Miaohe Lin

[permalink] [raw]
Subject: [PATCH] KVM: vmx: remove unreachable statement in vmx_get_msr_feature()

From: Miaohe Lin <[email protected]>

We have no way to reach the final statement, remove it.
Signed-off-by: Miaohe Lin <[email protected]>
---
arch/x86/kvm/vmx/vmx.c | 2 --
1 file changed, 2 deletions(-)

diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c
index e7ea332ad1e8..e58a0daf0f86 100644
--- a/arch/x86/kvm/vmx/vmx.c
+++ b/arch/x86/kvm/vmx/vmx.c
@@ -1781,8 +1781,6 @@ static int vmx_get_msr_feature(struct kvm_msr_entry *msr)
default:
return 1;
}
-
- return 0;
}

/*
--
2.19.1


2019-12-05 10:19:42

by Paolo Bonzini

[permalink] [raw]
Subject: Re: [PATCH] KVM: vmx: remove unreachable statement in vmx_get_msr_feature()

On 05/12/19 03:24, linmiaohe wrote:
> From: Miaohe Lin <[email protected]>
>
> We have no way to reach the final statement, remove it.
> Signed-off-by: Miaohe Lin <[email protected]>
> ---
> arch/x86/kvm/vmx/vmx.c | 2 --
> 1 file changed, 2 deletions(-)
>
> diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c
> index e7ea332ad1e8..e58a0daf0f86 100644
> --- a/arch/x86/kvm/vmx/vmx.c
> +++ b/arch/x86/kvm/vmx/vmx.c
> @@ -1781,8 +1781,6 @@ static int vmx_get_msr_feature(struct kvm_msr_entry *msr)
> default:
> return 1;
> }
> -
> - return 0;
> }
>
> /*
>

Queued, thanks.

Paolo

2019-12-05 13:45:41

by Liran Alon

[permalink] [raw]
Subject: Re: [PATCH] KVM: vmx: remove unreachable statement in vmx_get_msr_feature()



> On 5 Dec 2019, at 4:24, linmiaohe <[email protected]> wrote:
>
> From: Miaohe Lin <[email protected]>
>
> We have no way to reach the final statement, remove it.
> Signed-off-by: Miaohe Lin <[email protected]>
> ---
> arch/x86/kvm/vmx/vmx.c | 2 --
> 1 file changed, 2 deletions(-)
>
> diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c
> index e7ea332ad1e8..e58a0daf0f86 100644
> --- a/arch/x86/kvm/vmx/vmx.c
> +++ b/arch/x86/kvm/vmx/vmx.c
> @@ -1781,8 +1781,6 @@ static int vmx_get_msr_feature(struct kvm_msr_entry *msr)
> default:
> return 1;
> }
> -
> - return 0;
> }

I personally just prefer to remove the “default” case and change this “return 0;” to “return 1;”.
But it’s a matter of taste of course.

2019-12-06 01:54:09

by Miaohe Lin

[permalink] [raw]
Subject: Re: [PATCH] KVM: vmx: remove unreachable statement in vmx_get_msr_feature()

>
>I personally just prefer to remove the “default” case and change this “return 0;” to “return 1;”.
>But it’s a matter of taste of course.
>
Yes. As what " Turnip greens, all have love " said. ^_^

2019-12-06 03:12:41

by Wanpeng Li

[permalink] [raw]
Subject: Re: [PATCH] KVM: vmx: remove unreachable statement in vmx_get_msr_feature()

On Fri, 6 Dec 2019 at 09:54, linmiaohe <[email protected]> wrote:
>
> >
> >I personally just prefer to remove the “default” case and change this “return 0;” to “return 1;”.
> >But it’s a matter of taste of course.
> >
> Yes. As what " Turnip greens, all have love " said. ^_^

Actually it is a great appreciated to introduce something more useful
instead of tons of cleanups, I saw guys did one cleanup and can incur
several bugs before.

Wanpeng

2019-12-06 03:42:36

by Miaohe Lin

[permalink] [raw]
Subject: Re: [PATCH] KVM: vmx: remove unreachable statement in vmx_get_msr_feature()

Wanpeng Li <[email protected]> wrote:
>>
>> >
>> >I personally just prefer to remove the “default” case and change this “return 0;” to “return 1;”.
>> >But it’s a matter of taste of course.
>> >
>> Yes. As what " Turnip greens, all have love " said. ^_^
>
>Actually it is a great appreciated to introduce something more useful instead of tons of cleanups, I saw guys did one cleanup and can incur several bugs before.
>
I'd like to introduce something more useful, but side corner cleanups may be hard to
found out something to introduce. And such cleanups can also be validated by code inspection
to avoid something bad. Many thanks.

2019-12-06 10:00:46

by Paolo Bonzini

[permalink] [raw]
Subject: Re: [PATCH] KVM: vmx: remove unreachable statement in vmx_get_msr_feature()

On 06/12/19 04:41, linmiaohe wrote:
> Wanpeng Li <[email protected]> wrote:
>>>
>>>>
>>>> I personally just prefer to remove the “default” case and change this “return 0;” to “return 1;”.
>>>> But it’s a matter of taste of course.
>>>>
>>> Yes. As what " Turnip greens, all have love " said. ^_^
>>
>> Actually it is a great appreciated to introduce something more useful instead of tons of cleanups, I saw guys did one cleanup and can incur several bugs before.
>>
> I'd like to introduce something more useful, but side corner cleanups may be hard to
> found out something to introduce. And such cleanups can also be validated by code inspection
> to avoid something bad. Many thanks.
>

Yeah, I think you have been doing a good job. Usually, when the
cleanups introduce bugs there are many other "suspicious" things. For
me it's clear that you're learning the code and not just messing around.

Paolo

2019-12-07 06:53:51

by Miaohe Lin

[permalink] [raw]
Subject: Re: [PATCH] KVM: vmx: remove unreachable statement in vmx_get_msr_feature()


Paolo Bonzini <[email protected]> wrote:
>> Wanpeng Li <[email protected]> wrote:
>>>>
>>>>>
>>>>> I personally just prefer to remove the “default” case and change this “return 0;” to “return 1;”.
>>>>> But it’s a matter of taste of course.
>>>>>
>>>> Yes. As what " Turnip greens, all have love " said. ^_^
>>>
>>> Actually it is a great appreciated to introduce something more useful instead of tons of cleanups, I saw guys did one cleanup and can incur several bugs before.
>>>
>> I'd like to introduce something more useful, but side corner cleanups
>> may be hard to found out something to introduce. And such cleanups can
>> also be validated by code inspection to avoid something bad. Many thanks.
>>
>
>Yeah, I think you have been doing a good job. Usually, when the cleanups introduce bugs there are many other "suspicious" things. For me it's clear that you're learning the code and not just messing around.
>
>Paolo

Many thanks for your approve. I really feel grateful for it. In fact, I am investigating the
code and expect a deep understanding. But it's really a enormous, sophisticated and
wonderful world, what I can do now is try to keep the code clean. Maybe I could introduce some useful
features someday. Many thanks again.

Best wishes.