virtmgr: Clean up unnecessary match statement
Use the '?' operator instead of manually returning the Err().
Centralize the calls to OwnedFdt::as_mut() into a single call.
Test: m virtmgr
Change-Id: I2ceead0796b34962ab5d22e2a8fb71795c197e60
diff --git a/virtualizationmanager/src/debug_config.rs b/virtualizationmanager/src/debug_config.rs
index 451d1c6..6b495aa 100644
--- a/virtualizationmanager/src/debug_config.rs
+++ b/virtualizationmanager/src/debug_config.rs
@@ -214,15 +214,15 @@
}
fn from_custom_debug_overlay_policy(debug_level: DebugLevel, path: &Path) -> Result<Self> {
- match OwnedFdt::from_overlay_onto_new_fdt(path) {
- Ok(fdt) => Ok(Self {
- debug_level,
- debug_policy_log: get_fdt_prop_bool(fdt.as_fdt(), &DP_LOG_PATH)?,
- debug_policy_ramdump: get_fdt_prop_bool(fdt.as_fdt(), &DP_RAMDUMP_PATH)?,
- debug_policy_adb: get_fdt_prop_bool(fdt.as_fdt(), &DP_ADB_PATH)?,
- }),
- Err(err) => Err(err),
- }
+ let owned_fdt = OwnedFdt::from_overlay_onto_new_fdt(path)?;
+ let fdt = owned_fdt.as_fdt();
+
+ Ok(Self {
+ debug_level,
+ debug_policy_log: get_fdt_prop_bool(fdt, &DP_LOG_PATH)?,
+ debug_policy_ramdump: get_fdt_prop_bool(fdt, &DP_RAMDUMP_PATH)?,
+ debug_policy_adb: get_fdt_prop_bool(fdt, &DP_ADB_PATH)?,
+ })
}
fn from_host(debug_level: DebugLevel) -> Result<Self> {