Skip to content

Commit 1c0180c

Browse files
JohnsPonyavpatel
authored andcommitted
RISC-V: KVM: Remove unnecessary 'ret' assignment
If execution reaches "ret = 0" assignment in kvm_riscv_vcpu_pmu_event_info() then it means kvm_vcpu_write_guest() returned 0 hence ret is already zero and does not need to be assigned 0. Fixes: e309fd1 ("RISC-V: KVM: Implement get event info function") Signed-off-by: Qiang Ma <maqianga@uniontech.com> Reviewed-by: Anup Patel <anup@brainfault.org> Link: https://lore.kernel.org/r/20251229072530.3075496-1-maqianga@uniontech.com Signed-off-by: Anup Patel <anup@brainfault.org>
1 parent 63804fe commit 1c0180c

1 file changed

Lines changed: 1 addition & 4 deletions

File tree

arch/riscv/kvm/vcpu_pmu.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -494,12 +494,9 @@ int kvm_riscv_vcpu_pmu_event_info(struct kvm_vcpu *vcpu, unsigned long saddr_low
494494
}
495495

496496
ret = kvm_vcpu_write_guest(vcpu, shmem, einfo, shmem_size);
497-
if (ret) {
497+
if (ret)
498498
ret = SBI_ERR_INVALID_ADDRESS;
499-
goto free_mem;
500-
}
501499

502-
ret = 0;
503500
free_mem:
504501
kfree(einfo);
505502
out:

0 commit comments

Comments
 (0)