Skip to content

Commit

Permalink
RISC-V: KVM: Make kvm_riscv_guest_timer_init a void function
Browse files Browse the repository at this point in the history
It can never fail so convey that fact explicitly by making the function
void. Also in kvm_arch_init_vm it makes it clear that there no need
to do any cleanup after kvm_riscv_gstage_vmid_init has been called.

Signed-off-by: Nikolay Borisov <nborisov@suse.com>
Signed-off-by: Anup Patel <anup@brainfault.org>
  • Loading branch information
Nikolay Borisov authored and Anup Patel committed Jul 29, 2022
1 parent 6259d2f commit cca986f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion arch/riscv/include/asm/kvm_vcpu_timer.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,6 @@ int kvm_riscv_vcpu_timer_init(struct kvm_vcpu *vcpu);
int kvm_riscv_vcpu_timer_deinit(struct kvm_vcpu *vcpu);
int kvm_riscv_vcpu_timer_reset(struct kvm_vcpu *vcpu);
void kvm_riscv_vcpu_timer_restore(struct kvm_vcpu *vcpu);
int kvm_riscv_guest_timer_init(struct kvm *kvm);
void kvm_riscv_guest_timer_init(struct kvm *kvm);

#endif
4 changes: 1 addition & 3 deletions arch/riscv/kvm/vcpu_timer.c
Original file line number Diff line number Diff line change
Expand Up @@ -214,12 +214,10 @@ void kvm_riscv_vcpu_timer_restore(struct kvm_vcpu *vcpu)
#endif
}

int kvm_riscv_guest_timer_init(struct kvm *kvm)
void kvm_riscv_guest_timer_init(struct kvm *kvm)
{
struct kvm_guest_timer *gt = &kvm->arch.timer;

riscv_cs_get_mult_shift(&gt->nsec_mult, &gt->nsec_shift);
gt->time_delta = -get_cycles64();

return 0;
}
4 changes: 3 additions & 1 deletion arch/riscv/kvm/vm.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ int kvm_arch_init_vm(struct kvm *kvm, unsigned long type)
return r;
}

return kvm_riscv_guest_timer_init(kvm);
kvm_riscv_guest_timer_init(kvm);

return 0;
}

void kvm_arch_destroy_vm(struct kvm *kvm)
Expand Down

0 comments on commit cca986f

Please sign in to comment.