libfdt: Change FdtNodeMut::add_subnode*(self, ...)
As the borrow checker forbids having more than one mutable reference at
the same time and as FdtNodeMut is a wrapper around &mut Fdt, take the
ownership of the node when obtaining its first_subnode, allowing less
convoluted code when walking a mutable DT.
Bug: 324046698
Test: m pvmfw virtmgr fsfdt librialto libfdtpci
Test: m liblibfdt.integration_test libpvmfw.device_assignment.test
Change-Id: I1bbbebe263c21f95b3637bb6266b4308079ada8f
diff --git a/pvmfw/src/fdt.rs b/pvmfw/src/fdt.rs
index bd47ed7..311f467 100644
--- a/pvmfw/src/fdt.rs
+++ b/pvmfw/src/fdt.rs
@@ -443,7 +443,7 @@
vm_ref_dt: &Fdt,
props_info: &BTreeMap<CString, Vec<u8>>,
) -> libfdt::Result<()> {
- let mut root_vm_dt = vm_dt.root_mut()?;
+ let root_vm_dt = vm_dt.root_mut()?;
let mut avf_vm_dt = root_vm_dt.add_subnode(cstr!("avf"))?;
// TODO(b/318431677): Validate nodes beyond /avf.
let avf_node = vm_ref_dt.node(cstr!("/avf"))?.ok_or(FdtError::NotFound)?;