Skip to content

Commit b93fdee

Browse files
committed
refactor(aarch64): use midr_el1 host path directly
Stop creating PathBuf from a heap allocated constant string. Signed-off-by: Egor Lazarchuk <[email protected]>
1 parent 49c1794 commit b93fdee

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

src/vmm/src/arch/aarch64/vcpu.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
use std::fmt::{Debug, Write};
99
use std::mem::offset_of;
10-
use std::path::PathBuf;
1110

1211
use kvm_bindings::*;
1312
use kvm_ioctls::{VcpuExit, VcpuFd, VmFd};
@@ -48,9 +47,7 @@ pub enum VcpuArchError {
4847
/// Extract the Manufacturer ID from the host.
4948
/// The ID is found between bits 24-31 of MIDR_EL1 register.
5049
pub fn get_manufacturer_id_from_host() -> Result<u32, VcpuArchError> {
51-
let midr_el1_path =
52-
&PathBuf::from("/sys/devices/system/cpu/cpu0/regs/identification/midr_el1".to_string());
53-
50+
let midr_el1_path = "/sys/devices/system/cpu/cpu0/regs/identification/midr_el1";
5451
let midr_el1 = std::fs::read_to_string(midr_el1_path).map_err(|err| {
5552
VcpuArchError::GetMidrEl1(format!("Failed to get MIDR_EL1 from host path: {err}"))
5653
})?;

0 commit comments

Comments
 (0)