lkml.org 
[lkml]   [2021]   [Nov]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] KVM: arm64: remove unneeded comparison
Date
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));

/*
--
2.33.0
\
 
 \ /
  Last update: 2021-11-14 07:42    [W:0.100 / U:1.116 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site