From: Zenghui Yu <yuzenghui@huawei.com>
To: Jason Wang <wangborong@cdjrlc.com>
Cc: <catalin.marinas@arm.com>, <maz@kernel.org>, <will@kernel.org>,
<james.morse@arm.com>, <alexandru.elisei@arm.com>,
<suzuki.poulose@arm.com>, <linux-arm-kernel@lists.infradead.org>,
<kvmarm@lists.cs.columbia.edu>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] KVM: arm64: remove unneeded comparison
Date: Sun, 14 Nov 2021 15:11:53 +0800 [thread overview]
Message-ID: <2b9f6a42-825f-1141-06db-932732a0cf99@huawei.com> (raw)
In-Reply-To: <20211114064026.277024-1-wangborong@cdjrlc.com>
Hi,
On 2021/11/14 14:40, Jason Wang wrote:
> The unsigned expression compared with zero `target < 0' is
> unneeded and its result is always false. we can also check the
> target's value returned from `kvm_target_cpu' is one of the
> KVM_* macros, and these macros are defined greater than or equal
> to 0.
> Therefore, the comparison code block:
> if (target < 0)
> return -ENODEV;
> is unneeded. We can safely remove it.
>
> Signed-off-by: Jason Wang <wangborong@cdjrlc.com>
> ---
> arch/arm64/kvm/guest.c | 3 ---
> 1 file changed, 3 deletions(-)
>
> diff --git a/arch/arm64/kvm/guest.c b/arch/arm64/kvm/guest.c
> index 5ce26bedf23c..1605cb71dd52 100644
> --- a/arch/arm64/kvm/guest.c
> +++ b/arch/arm64/kvm/guest.c
> @@ -873,9 +873,6 @@ int kvm_vcpu_preferred_target(struct kvm_vcpu_init *init)
> {
> u32 target = kvm_target_cpu();
>
> - if (target < 0)
> - return -ENODEV;
> -
> memset(init, 0, sizeof(*init));
>
> /*
FYI there's already a similar change in mainline now:
https://git.kernel.org/torvalds/c/08e873cb70f3
Thanks,
Zenghui
prev parent reply other threads:[~2021-11-14 7:12 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-14 6:40 Jason Wang
2021-11-14 7:11 ` Zenghui Yu [this message]
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=2b9f6a42-825f-1141-06db-932732a0cf99@huawei.com \
--to=yuzenghui@huawei.com \
--cc=alexandru.elisei@arm.com \
--cc=catalin.marinas@arm.com \
--cc=james.morse@arm.com \
--cc=kvmarm@lists.cs.columbia.edu \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maz@kernel.org \
--cc=suzuki.poulose@arm.com \
--cc=wangborong@cdjrlc.com \
--cc=will@kernel.org \
/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
all inboxes | Powered by JetHome®