[PATCH] KVM: x86: Remove superfluous brackets in kvm_arch_dev_ioctl()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Remove unnecessary brackets from the case statements in
kvm_arch_dev_ioctl().

The brackets are visually confusing and error-prone, e.g., brackets of
case KVM_X86_GET_MCE_CAP_SUPPORTED accidently includes case
KVM_GET_MSR_FEATURE_INDEX_LIST and KVM_GET_MSRS.

Signed-off-by: Xiaoyao Li <xiaoyao.li@xxxxxxxxx>
---
 arch/x86/kvm/x86.c | 33 ++++++++++++++-------------------
 1 file changed, 14 insertions(+), 19 deletions(-)

diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index ddd1d296bd20..9efd693189df 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -3412,14 +3412,16 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext)
 long kvm_arch_dev_ioctl(struct file *filp,
 			unsigned int ioctl, unsigned long arg)
 {
-	void __user *argp = (void __user *)arg;
+	struct kvm_msr_list __user *user_msr_list;
+	struct kvm_cpuid2 __user *cpuid_arg;
+	struct kvm_msr_list msr_list;
+	struct kvm_cpuid2 cpuid;
+	unsigned int n;
 	long r;
 
 	switch (ioctl) {
-	case KVM_GET_MSR_INDEX_LIST: {
-		struct kvm_msr_list __user *user_msr_list = argp;
-		struct kvm_msr_list msr_list;
-		unsigned n;
+	case KVM_GET_MSR_INDEX_LIST:
+		user_msr_list = (void __user *)arg;
 
 		r = -EFAULT;
 		if (copy_from_user(&msr_list, user_msr_list, sizeof(msr_list)))
@@ -3441,11 +3443,9 @@ long kvm_arch_dev_ioctl(struct file *filp,
 			goto out;
 		r = 0;
 		break;
-	}
 	case KVM_GET_SUPPORTED_CPUID:
-	case KVM_GET_EMULATED_CPUID: {
-		struct kvm_cpuid2 __user *cpuid_arg = argp;
-		struct kvm_cpuid2 cpuid;
+	case KVM_GET_EMULATED_CPUID:
+		cpuid_arg = (void __user *)arg;
 
 		r = -EFAULT;
 		if (copy_from_user(&cpuid, cpuid_arg, sizeof(cpuid)))
@@ -3461,18 +3461,15 @@ long kvm_arch_dev_ioctl(struct file *filp,
 			goto out;
 		r = 0;
 		break;
-	}
-	case KVM_X86_GET_MCE_CAP_SUPPORTED: {
+	case KVM_X86_GET_MCE_CAP_SUPPORTED:
 		r = -EFAULT;
-		if (copy_to_user(argp, &kvm_mce_cap_supported,
+		if (copy_to_user((void __user *)arg, &kvm_mce_cap_supported,
 				 sizeof(kvm_mce_cap_supported)))
 			goto out;
 		r = 0;
 		break;
-	case KVM_GET_MSR_FEATURE_INDEX_LIST: {
-		struct kvm_msr_list __user *user_msr_list = argp;
-		struct kvm_msr_list msr_list;
-		unsigned int n;
+	case KVM_GET_MSR_FEATURE_INDEX_LIST:
+		user_msr_list = (void __user *)arg;
 
 		r = -EFAULT;
 		if (copy_from_user(&msr_list, user_msr_list, sizeof(msr_list)))
@@ -3490,11 +3487,9 @@ long kvm_arch_dev_ioctl(struct file *filp,
 			goto out;
 		r = 0;
 		break;
-	}
 	case KVM_GET_MSRS:
-		r = msr_io(NULL, argp, do_get_msr_feature, 1);
+		r = msr_io(NULL, (void __user *)arg, do_get_msr_feature, 1);
 		break;
-	}
 	default:
 		r = -EINVAL;
 	}
-- 
2.19.1




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux