diff --git a/vmm/src/vm.rs b/vmm/src/vm.rs index 0f3e67487..3b831a714 100644 --- a/vmm/src/vm.rs +++ b/vmm/src/vm.rs @@ -407,20 +407,16 @@ impl VmmOps for VmOps { } fn mmio_read(&self, gpa: u64, data: &mut [u8]) -> hypervisor::vm::Result<()> { - if let Err(e) = self.mmio_bus.read(gpa, data) { - if let vm_device::BusError::MissingAddressRange = e { - warn!("Guest MMIO read to unregistered address 0x{:x}", gpa); - } + if let Err(vm_device::BusError::MissingAddressRange) = self.mmio_bus.read(gpa, data) { + warn!("Guest MMIO read to unregistered address 0x{:x}", gpa); } Ok(()) } fn mmio_write(&self, gpa: u64, data: &[u8]) -> hypervisor::vm::Result<()> { match self.mmio_bus.write(gpa, data) { - Err(e) => { - if let vm_device::BusError::MissingAddressRange = e { - warn!("Guest MMIO write to unregistered address 0x{:x}", gpa); - } + Err(vm_device::BusError::MissingAddressRange) => { + warn!("Guest MMIO write to unregistered address 0x{:x}", gpa); } Ok(Some(barrier)) => { info!("Waiting for barrier"); @@ -434,10 +430,8 @@ impl VmmOps for VmOps { #[cfg(target_arch = "x86_64")] fn pio_read(&self, port: u64, data: &mut [u8]) -> hypervisor::vm::Result<()> { - if let Err(e) = self.io_bus.read(port, data) { - if let vm_device::BusError::MissingAddressRange = e { - warn!("Guest PIO read to unregistered address 0x{:x}", port); - } + if let Err(vm_device::BusError::MissingAddressRange) = self.io_bus.read(port, data) { + warn!("Guest PIO read to unregistered address 0x{:x}", port); } Ok(()) } @@ -450,10 +444,8 @@ impl VmmOps for VmOps { } match self.io_bus.write(port, data) { - Err(e) => { - if let vm_device::BusError::MissingAddressRange = e { - warn!("Guest PIO write to unregistered address 0x{:x}", port); - } + Err(vm_device::BusError::MissingAddressRange) => { + warn!("Guest PIO write to unregistered address 0x{:x}", port); } Ok(Some(barrier)) => { info!("Waiting for barrier");