mirror of
https://github.com/aljazceru/kata-containers.git
synced 2026-02-21 14:34:25 +01:00
fmt: refactor in pci & balloon
1. merge hashmap get logic according to Xuewei suggestion. 2. do cargo fmt Signed-off-by: Chao Wu <chaowu@linux.alibaba.com>
This commit is contained in:
@@ -299,8 +299,7 @@ pub fn setup_mptable<M: GuestMemory>(
|
||||
// Patch irq routing entry for mptable if it is registered
|
||||
// as PCI legacy irq.
|
||||
if let Some(irq_device) = pci_legacy_irqs {
|
||||
if irq_device.contains_key(&i) {
|
||||
let device_id = irq_device.get(&i).unwrap();
|
||||
if let Some(device_id) = irq_device.get(&i) {
|
||||
mpc_intsrc.0.srcbus = BUS_ID_PCI;
|
||||
mpc_intsrc.0.srcbusirq = device_id << 2;
|
||||
}
|
||||
|
||||
@@ -675,11 +675,14 @@ where
|
||||
error!("Failed to write config space");
|
||||
return Err(ConfigError::InvalidOffset(offset));
|
||||
};
|
||||
let Some(dst) = start.checked_add(data.len())
|
||||
.and_then(|end| config_slice.get_mut(start..end)) else
|
||||
{
|
||||
let Some(dst) = start
|
||||
.checked_add(data.len())
|
||||
.and_then(|end| config_slice.get_mut(start..end))
|
||||
else {
|
||||
error!("Failed to write config space");
|
||||
return Err(ConfigError::InvalidOffsetPlusDataLen(offset + data.len() as u64));
|
||||
return Err(ConfigError::InvalidOffsetPlusDataLen(
|
||||
offset + data.len() as u64,
|
||||
));
|
||||
};
|
||||
dst.copy_from_slice(data);
|
||||
Ok(())
|
||||
|
||||
Reference in New Issue
Block a user