From 89479b41dbd39b9c87b5d93e88971c5615ee73d1 Mon Sep 17 00:00:00 2001 From: David Stevens Date: Fri, 17 Jun 2022 15:03:38 +0900 Subject: [PATCH] crosvm/linux: fix direct compilation error Fix a compilation error in the --features=direct build caused by CL:3696671. BUG=None TEST=cargo build --no-default-features --features=direct Change-Id: Idb90d4712064b007672589db65d93b0168508a8f Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3708388 Reviewed-by: Junichi Uekawa Tested-by: kokoro Commit-Queue: David Stevens --- src/crosvm/linux/mod.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/crosvm/linux/mod.rs b/src/crosvm/linux/mod.rs index 4c10713ad1..b6dff2c9cb 100644 --- a/src/crosvm/linux/mod.rs +++ b/src/crosvm/linux/mod.rs @@ -48,6 +48,8 @@ use devices::{HostBackendDeviceProvider, XhciController}; use hypervisor::kvm::{Kvm, KvmVcpu, KvmVm}; use hypervisor::{HypervisorCap, ProtectionType, Vm, VmCap}; use minijail::{self, Minijail}; +#[cfg(feature = "direct")] +use resources::Error as ResourceError; use resources::{AddressRange, Alloc, SystemAllocator}; use rutabaga_gfx::RutabagaGralloc; use sync::{Condvar, Mutex}; @@ -1426,8 +1428,9 @@ where #[cfg(feature = "direct")] if let Some(mmio) = &cfg.direct_mmio { for range in mmio.ranges.iter() { - sys_allocator - .reserve_mmio(range.base, range.len) + AddressRange::from_start_and_size(range.base, range.len) + .ok_or(ResourceError::OutOfSpace) + .and_then(|range| sys_allocator.reserve_mmio(range)) .with_context(|| { format!( "failed to reserved direct mmio: {:x}-{:x}",