[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Y8hWqgF6ZQdVF5pP@google.com>
Date: Wed, 18 Jan 2023 20:29:30 +0000
From: Sean Christopherson <seanjc@...gle.com>
To: zhang.songyi@....com.cn
Cc: pbonzini@...hat.com, tglx@...utronix.de, mingo@...hat.com,
bp@...en8.de, dave.hansen@...ux.intel.com, x86@...nel.org,
hpa@...or.com, kvm@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH linux-next] KVM: x86: remove redundant ret variable
On Wed, Nov 23, 2022, zhang.songyi@....com.cn wrote:
> From: zhang songyi <zhang.songyi@....com.cn>
>
> Return value from apic_get_tmcct() directly instead of taking
> this in another redundant variable.
>
> Signed-off-by: zhang songyi <zhang.songyi@....com.cn>
> ---
> arch/x86/kvm/lapic.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c
> index d7639d126e6c..707970804502 100644
> --- a/arch/x86/kvm/lapic.c
> +++ b/arch/x86/kvm/lapic.c
> @@ -1363,7 +1363,6 @@ static u32 apic_get_tmcct(struct kvm_lapic *apic)
> {
> ktime_t remaining, now;
> s64 ns;
> - u32 tmcct;
>
> ASSERT(apic != NULL);
>
> @@ -1378,10 +1377,9 @@ static u32 apic_get_tmcct(struct kvm_lapic *apic)
> remaining = 0;
>
> ns = mod_64(ktime_to_ns(remaining), apic->lapic_timer.period);
> - tmcct = div64_u64(ns,
> - (APIC_BUS_CYCLE_NS * apic->divide_count));
>
> - return tmcct;
> + return div64_u64(ns,
> + (APIC_BUS_CYCLE_NS * apic->divide_count));
No need to wrap here, this fits comfortably on a single line (so does the
existing code, i.e. not your "bug"). No need for v2, I'll fix up when applying.
Powered by blists - more mailing lists