Skip to content

Commit e8309ab

Browse files
committed
refactor(aarch64): remove Result type from apply_template
On aarch64 `apply_template` cannot fail, so no reason for `Result` return type. Signed-off-by: Egor Lazarchuk <[email protected]>
1 parent f5748a3 commit e8309ab

File tree

2 files changed

+3
-9
lines changed

2 files changed

+3
-9
lines changed

src/vmm/src/arch/aarch64/mod.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,6 @@ pub enum ConfigurationError {
5353
VcpuConfig(CpuConfigurationError),
5454
/// Error configuring the vcpu: {0}
5555
VcpuConfigure(KvmVcpuError),
56-
/// Error applying vcpu template: {0}
57-
VcpuApplyTemplate(CpuConfigurationError),
5856
}
5957

6058
/// The start of the memory area reserved for MMIO devices.
@@ -84,8 +82,7 @@ pub fn configure_system_for_boot(
8482
CpuConfiguration::new(cpu_template, vcpus).map_err(ConfigurationError::VcpuConfig)?;
8583

8684
// Apply CPU template to the base CpuConfiguration.
87-
let cpu_config = CpuConfiguration::apply_template(cpu_config, cpu_template)
88-
.map_err(ConfigurationError::VcpuApplyTemplate)?;
85+
let cpu_config = CpuConfiguration::apply_template(cpu_config, cpu_template);
8986

9087
let vcpu_config = VcpuConfig {
9188
vcpu_count: machine_config.vcpu_count,

src/vmm/src/cpu_config/aarch64/mod.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,7 @@ impl CpuConfiguration {
4949
}
5050

5151
/// Creates new guest CPU config based on the provided template
52-
pub fn apply_template(
53-
mut self,
54-
template: &CustomCpuTemplate,
55-
) -> Result<Self, CpuConfigurationError> {
52+
pub fn apply_template(mut self, template: &CustomCpuTemplate) -> Self {
5653
for (modifier, mut reg) in template.reg_modifiers.iter().zip(self.regs.iter_mut()) {
5754
match reg.size() {
5855
RegSize::U32 => {
@@ -73,7 +70,7 @@ impl CpuConfiguration {
7370
_ => unreachable!("Only 32, 64 and 128 bit wide registers are supported"),
7471
}
7572
}
76-
Ok(self)
73+
self
7774
}
7875

7976
/// Returns ids of registers that are changed

0 commit comments

Comments
 (0)