KVM: x86: Remove unnecessary brackets in kvm_arch_dev_ioctl()
PATCH v2 1/1 KVM: x86: Remove unnecessary brackets in kvm_arch_dev_ioctl()
In kvm_arch_dev_ioctl(), the brackets of case KVM_X86_GET_MCE_CAP_SUPPORTED accidently encapsulates case KVM_GET_MSR_FEATURE_INDEX_LIST and case KVM_GET_MSRS. It doesn't affect functionality but it's misleading.
Remove unnecessary brackets and opportunistically add a "break" in the default path.
--- arch/x86/kvm/x86.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/x86/kvm/x86.c +2 -2
@@ -3464,7 +3464,7 @@ long kvm_arch_dev_ioctl(struct file *filp, 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,sizeof (kvm_mce_cap_supported)))
@@ -3496,9 +3496,9 @@ long kvm_arch_dev_ioctl(struct file *filp,case KVM_GET_MSRS : r =msr_io (NULL , argp, do_get_msr_feature,1 );break ; - }default : r = -EINVAL ; +break ; } out:return r;
Signature · 1 line
2.19.1
Quoted 27 lines · Xiaoyao Li
In
kvm_arch_dev_ioctl(), the brackets of caseKVM_X86_GET_MCE_CAP_SUPPORTEDaccidently encapsulates caseKVM_GET_MSR_FEATURE_INDEX_LISTand caseKVM_GET_MSRS. It doesn't affect functionality but it's misleading.Remove unnecessary brackets and opportunistically add a "break" in the default path.
Suggested-by Sean Christopherson <[email protected]>Signed-off-by Xiaoyao Li <[email protected]>--- arch/x86/kvm/x86.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)arch/x86/kvm/x86.c +1
-1@@ -3464,7 +3464,7 @@ long kvm_arch_dev_ioctl(struct file *filp, 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,sizeof (kvm_mce_cap_supported)))
arch/x86/kvm/x86.c long kvm_arch_dev_ioctl(struct file *filp, · line 3504
Quoted 10 lines
arch/x86/kvm/x86.c +1
-1@@ -3496,9 +3496,9 @@ long kvm_arch_dev_ioctl(struct file *filp,case KVM_GET_MSRS : r =msr_io (NULL , argp, do_get_msr_feature,1 );break ; - }default : r = -EINVAL ; +break ; } out:return r;
Signature · 1 line
Vitaly
hi, Paolo?
Quoted 38 lines · Xiaoyao Li
In
kvm_arch_dev_ioctl(), the brackets of caseKVM_X86_GET_MCE_CAP_SUPPORTEDaccidently encapsulates caseKVM_GET_MSR_FEATURE_INDEX_LISTand caseKVM_GET_MSRS. It doesn't affect functionality but it's misleading.Remove unnecessary brackets and opportunistically add a "break" in the default path.
Suggested-by Sean Christopherson <[email protected]>Signed-off-by Xiaoyao Li <[email protected]>--- arch/x86/kvm/x86.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)arch/x86/kvm/x86.c +2
-2@@ -3464,7 +3464,7 @@ long kvm_arch_dev_ioctl(struct file *filp, 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,sizeof (kvm_mce_cap_supported)))@@ -3496,9 +3496,9 @@ long kvm_arch_dev_ioctl(struct file *filp,case KVM_GET_MSRS : r =msr_io (NULL , argp, do_get_msr_feature,1 );break ; - }default : r = -EINVAL ; +break ; } out:return r;
Quoted 28 lines · Xiaoyao Li
In
kvm_arch_dev_ioctl(), the brackets of caseKVM_X86_GET_MCE_CAP_SUPPORTEDaccidently encapsulates caseKVM_GET_MSR_FEATURE_INDEX_LISTand caseKVM_GET_MSRS. It doesn't affect functionality but it's misleading.Remove unnecessary brackets and opportunistically add a "break" in the default path.
Suggested-by Sean Christopherson <[email protected]>Signed-off-by Xiaoyao Li <[email protected]>--- arch/x86/kvm/x86.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)arch/x86/kvm/x86.c +1
-1@@ -3464,7 +3464,7 @@ long kvm_arch_dev_ioctl(struct file *filp, 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,sizeof (kvm_mce_cap_supported)))
arch/x86/kvm/x86.c long kvm_arch_dev_ioctl(struct file *filp, · line 3504
Quoted 10 lines
arch/x86/kvm/x86.c +1
-1@@ -3496,9 +3496,9 @@ long kvm_arch_dev_ioctl(struct file *filp,case KVM_GET_MSRS : r =msr_io (NULL , argp, do_get_msr_feature,1 );break ; - }default : r = -EINVAL ; +break ; } out:return r;
Queued as "KVM: x86: Code style cleanup in kvm_arch_dev_ioctl()", thanks.
Paolo