Skip to content

Commit f186fe9

Browse files
committed
refactor(vmm): Remove unnecessary map_err()
Remove unnecessary map_err()s in normalize() thanks to #[from]. Signed-off-by: Takahiro Itazuri <[email protected]>
1 parent 2834fe5 commit f186fe9

File tree

1 file changed

+9
-12
lines changed

1 file changed

+9
-12
lines changed

src/vmm/src/cpu_config/x86_64/cpuid/normalize.rs

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -205,24 +205,21 @@ impl super::Cpuid {
205205
.checked_shl(u32::from(cpu_bits))
206206
.ok_or(NormalizeCpuidError::CpuBits(cpu_bits))?;
207207
self.update_vendor_id()?;
208-
self.update_feature_info_entry(cpu_index, cpu_count)
209-
.map_err(NormalizeCpuidError::FeatureInformation)?;
210-
self.update_extended_topology_entry(cpu_index, cpu_count, cpu_bits, cpus_per_core)
211-
.map_err(NormalizeCpuidError::ExtendedTopology)?;
212-
self.update_extended_cache_features()
213-
.map_err(NormalizeCpuidError::ExtendedCacheFeatures)?;
208+
self.update_feature_info_entry(cpu_index, cpu_count)?;
209+
self.update_extended_topology_entry(cpu_index, cpu_count, cpu_bits, cpus_per_core)?;
210+
self.update_extended_cache_features()?;
214211

215212
// Apply manufacturer specific modifications.
216213
match self {
217214
// Apply Intel specific modifications.
218-
Self::Intel(intel_cpuid) => intel_cpuid
219-
.normalize(cpu_index, cpu_count, cpus_per_core)
220-
.map_err(NormalizeCpuidError::Intel),
215+
Self::Intel(intel_cpuid) => {
216+
intel_cpuid.normalize(cpu_index, cpu_count, cpus_per_core)?;
217+
}
221218
// Apply AMD specific modifications.
222-
Self::Amd(amd_cpuid) => amd_cpuid
223-
.normalize(cpu_index, cpu_count, cpus_per_core)
224-
.map_err(NormalizeCpuidError::Amd),
219+
Self::Amd(amd_cpuid) => amd_cpuid.normalize(cpu_index, cpu_count, cpus_per_core)?,
225220
}
221+
222+
Ok(())
226223
}
227224

228225
/// Pass-through the vendor ID from the host. This is used to prevent modification of the vendor

0 commit comments

Comments
 (0)