vm-virtio: vhost-user-net: Map proper error when getting features

Simple patch replacing unwrap() with appropriate map_err().

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
This commit is contained in:
Sebastien Boeuf 2019-08-30 14:50:33 -07:00 committed by Rob Bradford
parent cdfe576eb1
commit a4ebcf486d

View File

@ -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.