Commit 08e873cb authored by YueHaibing's avatar YueHaibing Committed by Marc Zyngier

KVM: arm64: Change the return type of kvm_vcpu_preferred_target()

kvm_vcpu_preferred_target() always return 0 because kvm_target_cpu()
never returns a negative error code.
Signed-off-by: default avatarYueHaibing <yuehaibing@huawei.com>
Reviewed-by: default avatarAlexandru Elisei <alexandru.elisei@arm.com>
Signed-off-by: default avatarMarc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20211105011500.16280-1-yuehaibing@huawei.com
parent deacd669
...@@ -584,7 +584,7 @@ struct kvm_vcpu_stat { ...@@ -584,7 +584,7 @@ struct kvm_vcpu_stat {
u64 exits; u64 exits;
}; };
int kvm_vcpu_preferred_target(struct kvm_vcpu_init *init); void kvm_vcpu_preferred_target(struct kvm_vcpu_init *init);
unsigned long kvm_arm_num_regs(struct kvm_vcpu *vcpu); unsigned long kvm_arm_num_regs(struct kvm_vcpu *vcpu);
int kvm_arm_copy_reg_indices(struct kvm_vcpu *vcpu, u64 __user *indices); int kvm_arm_copy_reg_indices(struct kvm_vcpu *vcpu, u64 __user *indices);
int kvm_arm_get_reg(struct kvm_vcpu *vcpu, const struct kvm_one_reg *reg); int kvm_arm_get_reg(struct kvm_vcpu *vcpu, const struct kvm_one_reg *reg);
......
...@@ -1397,12 +1397,9 @@ long kvm_arch_vm_ioctl(struct file *filp, ...@@ -1397,12 +1397,9 @@ long kvm_arch_vm_ioctl(struct file *filp,
return kvm_vm_ioctl_set_device_addr(kvm, &dev_addr); return kvm_vm_ioctl_set_device_addr(kvm, &dev_addr);
} }
case KVM_ARM_PREFERRED_TARGET: { case KVM_ARM_PREFERRED_TARGET: {
int err;
struct kvm_vcpu_init init; struct kvm_vcpu_init init;
err = kvm_vcpu_preferred_target(&init); kvm_vcpu_preferred_target(&init);
if (err)
return err;
if (copy_to_user(argp, &init, sizeof(init))) if (copy_to_user(argp, &init, sizeof(init)))
return -EFAULT; return -EFAULT;
......
...@@ -869,13 +869,10 @@ u32 __attribute_const__ kvm_target_cpu(void) ...@@ -869,13 +869,10 @@ u32 __attribute_const__ kvm_target_cpu(void)
return KVM_ARM_TARGET_GENERIC_V8; return KVM_ARM_TARGET_GENERIC_V8;
} }
int kvm_vcpu_preferred_target(struct kvm_vcpu_init *init) void kvm_vcpu_preferred_target(struct kvm_vcpu_init *init)
{ {
u32 target = kvm_target_cpu(); u32 target = kvm_target_cpu();
if (target < 0)
return -ENODEV;
memset(init, 0, sizeof(*init)); memset(init, 0, sizeof(*init));
/* /*
...@@ -885,8 +882,6 @@ int kvm_vcpu_preferred_target(struct kvm_vcpu_init *init) ...@@ -885,8 +882,6 @@ int kvm_vcpu_preferred_target(struct kvm_vcpu_init *init)
* target type. * target type.
*/ */
init->target = (__u32)target; init->target = (__u32)target;
return 0;
} }
int kvm_arch_vcpu_ioctl_get_fpu(struct kvm_vcpu *vcpu, struct kvm_fpu *fpu) int kvm_arch_vcpu_ioctl_get_fpu(struct kvm_vcpu *vcpu, struct kvm_fpu *fpu)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment