public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Sean Christopherson <seanjc@google.com>
To: zhang.songyi@zte.com.cn
Cc: pbonzini@redhat.com, tglx@linutronix.de, mingo@redhat.com,
	bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org,
	hpa@zytor.com, kvm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH linux-next] KVM: x86: remove redundant ret variable
Date: Wed, 18 Jan 2023 20:29:30 +0000	[thread overview]
Message-ID: <Y8hWqgF6ZQdVF5pP@google.com> (raw)
In-Reply-To: <202211231704457807160@zte.com.cn>

On Wed, Nov 23, 2022, zhang.songyi@zte.com.cn wrote:
> From: zhang songyi <zhang.songyi@zte.com.cn>
> 
> Return value from apic_get_tmcct() directly instead of taking
> this in another redundant variable.
> 
> Signed-off-by: zhang songyi <zhang.songyi@zte.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.

  reply	other threads:[~2023-01-18 20:30 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-23  9:04 [PATCH linux-next] KVM: x86: remove redundant ret variable zhang.songyi
2023-01-18 20:29 ` Sean Christopherson [this message]
2023-01-19 20:35 ` Sean Christopherson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Y8hWqgF6ZQdVF5pP@google.com \
    --to=seanjc@google.com \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    --cc=zhang.songyi@zte.com.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox