@@ -72,8 +72,7 @@ int kvm_arch_vcpu_should_kick(struct kvm_vcpu *vcpu)
72
72
int kvm_vm_ioctl_enable_cap (struct kvm * kvm ,
73
73
struct kvm_enable_cap * cap )
74
74
{
75
- int r ;
76
- u64 new_cap ;
75
+ int r = - EINVAL ;
77
76
78
77
if (cap -> flags )
79
78
return - EINVAL ;
@@ -86,9 +85,7 @@ int kvm_vm_ioctl_enable_cap(struct kvm *kvm,
86
85
break ;
87
86
case KVM_CAP_ARM_MTE :
88
87
mutex_lock (& kvm -> lock );
89
- if (!system_supports_mte () || kvm -> created_vcpus ) {
90
- r = - EINVAL ;
91
- } else {
88
+ if (system_supports_mte () && !kvm -> created_vcpus ) {
92
89
r = 0 ;
93
90
set_bit (KVM_ARCH_FLAG_MTE_ENABLED , & kvm -> arch .flags );
94
91
}
@@ -99,25 +96,22 @@ int kvm_vm_ioctl_enable_cap(struct kvm *kvm,
99
96
set_bit (KVM_ARCH_FLAG_SYSTEM_SUSPEND_ENABLED , & kvm -> arch .flags );
100
97
break ;
101
98
case KVM_CAP_ARM_EAGER_SPLIT_CHUNK_SIZE :
102
- new_cap = cap -> args [0 ];
103
-
104
99
mutex_lock (& kvm -> slots_lock );
105
100
/*
106
101
* To keep things simple, allow changing the chunk
107
102
* size only when no memory slots have been created.
108
103
*/
109
- if (! kvm_are_all_memslots_empty (kvm )) {
110
- r = - EINVAL ;
111
- } else if ( new_cap && ! kvm_is_block_size_supported ( new_cap )) {
112
- r = - EINVAL ;
113
- } else {
114
- r = 0 ;
115
- kvm -> arch . mmu . split_page_chunk_size = new_cap ;
104
+ if (kvm_are_all_memslots_empty (kvm )) {
105
+ u64 new_cap = cap -> args [ 0 ] ;
106
+
107
+ if (! new_cap || kvm_is_block_size_supported ( new_cap )) {
108
+ r = 0 ;
109
+ kvm -> arch . mmu . split_page_chunk_size = new_cap ;
110
+ }
116
111
}
117
112
mutex_unlock (& kvm -> slots_lock );
118
113
break ;
119
114
default :
120
- r = - EINVAL ;
121
115
break ;
122
116
}
123
117
0 commit comments