From a4ebcf486dd39fe1f209f7da4e1d8540115ec12b Mon Sep 17 00:00:00 2001 From: Sebastien Boeuf Date: Fri, 30 Aug 2019 14:50:33 -0700 Subject: [PATCH] vm-virtio: vhost-user-net: Map proper error when getting features Simple patch replacing unwrap() with appropriate map_err(). Signed-off-by: Sebastien Boeuf --- vm-virtio/src/vhost_user/net.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/vm-virtio/src/vhost_user/net.rs b/vm-virtio/src/vhost_user/net.rs index e23108111..014006620 100644 --- a/vm-virtio/src/vhost_user/net.rs +++ b/vm-virtio/src/vhost_user/net.rs @@ -68,7 +68,9 @@ impl<'a> Net { // Get features from backend, do negotiation to get a feature collection which // both VMM and backend support. - let backend_features = vhost_user_net.get_features().unwrap(); + let backend_features = vhost_user_net + .get_features() + .map_err(Error::VhostUserGetFeatures)?; avail_features &= backend_features; // Set features back is required by the vhost crate mechanism, since the // later vhost call will check if features is filled in master before execution.