@@ -441,7 +441,7 @@ impl KvmContext {
441441 // Check that all desired capabilities aer supported.
442442 for capability in capabilities. iter ( ) {
443443 if !kvm. check_extension ( * capability) {
444- Err ( Error :: KvmCap ( * capability) ) ? ;
444+ return Err ( Error :: KvmCap ( * capability) ) ;
445445 }
446446 }
447447
@@ -1396,7 +1396,7 @@ impl Vmm {
13961396 pub fn start_microvm ( & mut self ) -> UserResult {
13971397 info ! ( "VMM received instance start command" ) ;
13981398 if self . is_instance_initialized ( ) {
1399- Err ( StartMicrovmError :: MicroVMAlreadyRunning ) ? ;
1399+ return Err ( StartMicrovmError :: MicroVMAlreadyRunning . into ( ) ) ;
14001400 }
14011401
14021402 let request_ts = TimestampUs {
@@ -1630,7 +1630,7 @@ impl Vmm {
16301630 use VmmActionError :: BootSource ;
16311631
16321632 if self . is_instance_initialized ( ) {
1633- Err ( BootSource ( User , UpdateNotAllowedPostBoot ) ) ? ;
1633+ return Err ( BootSource ( User , UpdateNotAllowedPostBoot ) ) ;
16341634 }
16351635
16361636 let kernel_file =
@@ -1655,15 +1655,15 @@ impl Vmm {
16551655 /// Set the machine configuration of the microVM.
16561656 pub fn set_vm_configuration ( & mut self , machine_config : VmConfig ) -> UserResult {
16571657 if self . is_instance_initialized ( ) {
1658- Err ( VmConfigError :: UpdateNotAllowedPostBoot ) ? ;
1658+ return Err ( VmConfigError :: UpdateNotAllowedPostBoot . into ( ) ) ;
16591659 }
16601660
16611661 if machine_config. vcpu_count == Some ( 0 ) {
1662- Err ( VmConfigError :: InvalidVcpuCount ) ? ;
1662+ return Err ( VmConfigError :: InvalidVcpuCount . into ( ) ) ;
16631663 }
16641664
16651665 if machine_config. mem_size_mib == Some ( 0 ) {
1666- Err ( VmConfigError :: InvalidMemorySize ) ? ;
1666+ return Err ( VmConfigError :: InvalidMemorySize . into ( ) ) ;
16671667 }
16681668
16691669 let ht_enabled = machine_config
@@ -1677,7 +1677,7 @@ impl Vmm {
16771677 // If hyperthreading is enabled or is to be enabled in this call
16781678 // only allow vcpu count to be 1 or even.
16791679 if ht_enabled && vcpu_count_value > 1 && vcpu_count_value % 2 == 1 {
1680- Err ( VmConfigError :: InvalidVcpuCount ) ? ;
1680+ return Err ( VmConfigError :: InvalidVcpuCount . into ( ) ) ;
16811681 }
16821682
16831683 // Update all the fields that have a new value.
@@ -1698,7 +1698,7 @@ impl Vmm {
16981698 /// Inserts a network device to be attached when the VM starts.
16991699 pub fn insert_net_device ( & mut self , body : NetworkInterfaceConfig ) -> UserResult {
17001700 if self . is_instance_initialized ( ) {
1701- Err ( NetworkInterfaceError :: UpdateNotAllowedPostBoot ) ? ;
1701+ return Err ( NetworkInterfaceError :: UpdateNotAllowedPostBoot . into ( ) ) ;
17021702 }
17031703 self . device_configs
17041704 . network_interface
@@ -1814,7 +1814,7 @@ impl Vmm {
18141814 pub fn rescan_block_device ( & mut self , drive_id : & str ) -> UserResult {
18151815 // Rescan can only happen after the guest is booted.
18161816 if !self . is_instance_initialized ( ) {
1817- Err ( DriveError :: OperationNotAllowedPreBoot ) ? ;
1817+ return Err ( DriveError :: OperationNotAllowedPreBoot . into ( ) ) ;
18181818 }
18191819
18201820 // Safe to unwrap() because mmio_device_manager is initialized in init_devices(), which is
@@ -1846,7 +1846,7 @@ impl Vmm {
18461846 // If the drive_id does not exist, a new Block Device Config is added to the list.
18471847 pub fn insert_block_device ( & mut self , block_device_config : BlockDeviceConfig ) -> UserResult {
18481848 if self . is_instance_initialized ( ) {
1849- Err ( DriveError :: UpdateNotAllowedPostBoot ) ? ;
1849+ return Err ( DriveError :: UpdateNotAllowedPostBoot . into ( ) ) ;
18501850 }
18511851 self . device_configs
18521852 . block
0 commit comments