From c790a5b810bf27507daac0dfb504ab7e97707e80 Mon Sep 17 00:00:00 2001 From: StemCll Date: Mon, 31 Oct 2022 18:09:22 +0100 Subject: [PATCH] Fix warnings in aarch64 Signed-off-by: StemCll lydjotj6f@mozmail.com --- src/arch/src/aarch64/fdt.rs | 10 +++++----- src/arch/src/aarch64/regs.rs | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/arch/src/aarch64/fdt.rs b/src/arch/src/aarch64/fdt.rs index 6291f1918c63..e24a69bc6539 100644 --- a/src/arch/src/aarch64/fdt.rs +++ b/src/arch/src/aarch64/fdt.rs @@ -146,10 +146,10 @@ fn create_cpu_nodes(fdt: &mut FdtWriter, vcpu_mpidr: &[u64]) -> Result<()> { fdt.property_u32(cache.type_.of_cache_size(), size as u32)?; } if let Some(line_size) = cache.line_size { - fdt.property_u32(cache.type_.of_cache_line_size(), line_size as u32)?; + fdt.property_u32(cache.type_.of_cache_line_size(), u32::from(line_size))?; } if let Some(number_of_sets) = cache.number_of_sets { - fdt.property_u32(cache.type_.of_cache_sets(), number_of_sets as u32)?; + fdt.property_u32(cache.type_.of_cache_sets(), u32::from(number_of_sets))?; } } @@ -188,15 +188,15 @@ fn create_cpu_nodes(fdt: &mut FdtWriter, vcpu_mpidr: &[u64]) -> Result<()> { ))?); fdt.property_u32("phandle", cache_phandle)?; fdt.property_string("compatible", "cache")?; - fdt.property_u32("cache-level", cache.level as u32)?; + fdt.property_u32("cache-level", u32::from(cache.level))?; if let Some(size) = cache.size_ { fdt.property_u32(cache.type_.of_cache_size(), size as u32)?; } if let Some(line_size) = cache.line_size { - fdt.property_u32(cache.type_.of_cache_line_size(), line_size as u32)?; + fdt.property_u32(cache.type_.of_cache_line_size(), u32::from(line_size))?; } if let Some(number_of_sets) = cache.number_of_sets { - fdt.property_u32(cache.type_.of_cache_sets(), number_of_sets as u32)?; + fdt.property_u32(cache.type_.of_cache_sets(), u32::from(number_of_sets))?; } if let Some(cache_type) = cache.type_.of_cache_type() { fdt.property_null(cache_type)?; diff --git a/src/arch/src/aarch64/regs.rs b/src/arch/src/aarch64/regs.rs index 6afe32af747c..9aa06be0d278 100644 --- a/src/arch/src/aarch64/regs.rs +++ b/src/arch/src/aarch64/regs.rs @@ -237,7 +237,7 @@ pub fn setup_boot_regs( /// /// * `regid` - The index of the register we are checking. pub fn is_system_register(regid: u64) -> bool { - if (regid & KVM_REG_ARM_COPROC_MASK as u64) == KVM_REG_ARM_CORE as u64 { + if (regid & u64::from(KVM_REG_ARM_COPROC_MASK)) == u64::from(KVM_REG_ARM_CORE) { return false; } @@ -505,7 +505,7 @@ mod tests { assert!(!is_system_register(regid)); let regid = KVM_REG_ARM64 as u64 | KVM_REG_SIZE_U64 as u64 - | kvm_bindings::KVM_REG_ARM64_SYSREG as u64; + | u64::from(kvm_bindings::KVM_REG_ARM64_SYSREG); assert!(is_system_register(regid)); }