hypervisor: mshv: create_device returns DeviceFd directly
This aligns with KVM's code. No functional change.
@@ -918,12 +918,12 @@ impl MshvVm {
/// Creates an in-kernel device.
///
/// See the documentation for `MSHV_CREATE_DEVICE`.
- fn create_device(&self, device: &mut CreateDevice) -> vm::Result<Arc<dyn device::Device>> {
+ fn create_device(&self, device: &mut CreateDevice) -> vm::Result<DeviceFd> {
let device_fd = self
.fd
.create_device(device)
.map_err(|e| vm::HypervisorVmError::CreateDevice(e.into()))?;
- Ok(Arc::new(device_fd))
+ Ok(device_fd)
}
}
@@ -1117,8 +1117,9 @@ impl vm::Vm for MshvVm {
flags: 0,
};
- self.create_device(&mut vfio_dev)
- .map_err(|e| vm::HypervisorVmError::CreatePassthroughDevice(e.into()))
+ Ok(Arc::new(self.create_device(&mut vfio_dev).map_err(
+ |e| vm::HypervisorVmError::CreatePassthroughDevice(e.into()),
+ )?))
}
///
