[PATCH 03/13] RISC-V: KVM: Check kvm_riscv_vcpu_alloc_vector_context() return value
Atish Patra
atish.patra at linux.dev
Thu Jun 5 17:16:22 PDT 2025
On 6/4/25 11:14 PM, Anup Patel wrote:
> The kvm_riscv_vcpu_alloc_vector_context() does return an error code
> upon failure so don't ignore this in kvm_arch_vcpu_create().
currently, kvm_riscv_vcpu_alloc_vector_context returns -ENOMEM only.
Do you have some plans to return different errors in the future ?
Otherwise, the code remains same before and after.
> Signed-off-by: Anup Patel <apatel at ventanamicro.com>
> ---
> arch/riscv/kvm/vcpu.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/arch/riscv/kvm/vcpu.c b/arch/riscv/kvm/vcpu.c
> index e0a01af426ff..6a1914b21ec3 100644
> --- a/arch/riscv/kvm/vcpu.c
> +++ b/arch/riscv/kvm/vcpu.c
> @@ -148,8 +148,10 @@ int kvm_arch_vcpu_create(struct kvm_vcpu *vcpu)
>
> spin_lock_init(&vcpu->arch.reset_state.lock);
>
> - if (kvm_riscv_vcpu_alloc_vector_context(vcpu))
> - return -ENOMEM;
> + /* Setup VCPU vector context */
The function name is pretty self explanatory. So no need of this comment ?
> + rc = kvm_riscv_vcpu_alloc_vector_context(vcpu);
> + if (rc)
> + return rc;
>
> /* Setup VCPU timer */
> kvm_riscv_vcpu_timer_init(vcpu);
More information about the linux-riscv
mailing list