diff options
author | Sean Christopherson <seanjc@google.com> | 2024-08-02 22:01:35 +0200 |
---|---|---|
committer | Sean Christopherson <seanjc@google.com> | 2024-10-30 22:29:31 +0100 |
commit | 6cf9ef23d9428ca4950a818e3e70bd818748815a (patch) | |
tree | 64a59935364934ed7cc08379a58c4c2fd1b10b3b /virt | |
parent | KVM: Rework core loop of kvm_vcpu_on_spin() to use a single for-loop (diff) | |
download | linux-6cf9ef23d9428ca4950a818e3e70bd818748815a.tar.xz linux-6cf9ef23d9428ca4950a818e3e70bd818748815a.zip |
KVM: Return '0' directly when there's no task to yield to
Do "return 0" instead of initializing and returning a local variable in
kvm_vcpu_yield_to(), e.g. so that it's more obvious what the function
returns if there is no task.
No functional change intended.
Acked-by: Oliver Upton <oliver.upton@linux.dev>
Link: https://lore.kernel.org/r/20240802200136.329973-2-seanjc@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
Diffstat (limited to 'virt')
-rw-r--r-- | virt/kvm/kvm_main.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c index 5891bad97a7e..17048d9575e3 100644 --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c @@ -3772,7 +3772,7 @@ int kvm_vcpu_yield_to(struct kvm_vcpu *target) { struct pid *pid; struct task_struct *task = NULL; - int ret = 0; + int ret; rcu_read_lock(); pid = rcu_dereference(target->pid); @@ -3780,7 +3780,7 @@ int kvm_vcpu_yield_to(struct kvm_vcpu *target) task = get_pid_task(pid, PIDTYPE_PID); rcu_read_unlock(); if (!task) - return ret; + return 0; ret = yield_to(task, 1); put_task_struct(task); |