mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
pci: reevaluate #[allow] attributes
Drop stale #[allow]s whose lints no longer fire and convert the rest to #[expect], which warns if they ever stop being needed. Part of #8326. Signed-off-by: Tushar Khatri <hello@tusharkhatri.in>
This commit is contained in:
committed by
Rob Bradford
parent
7042922e83
commit
9eff92fb4b
@@ -145,7 +145,7 @@ impl PciBus {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(clippy::needless_pass_by_value)]
|
#[expect(clippy::needless_pass_by_value)]
|
||||||
pub fn register_mapping(
|
pub fn register_mapping(
|
||||||
&self,
|
&self,
|
||||||
dev: Arc<dyn BusDeviceSync>,
|
dev: Arc<dyn BusDeviceSync>,
|
||||||
|
|||||||
@@ -195,7 +195,6 @@ pub trait PciProgrammingInterface {
|
|||||||
|
|
||||||
/// Types of PCI capabilities.
|
/// Types of PCI capabilities.
|
||||||
#[derive(PartialEq, Eq, Copy, Clone)]
|
#[derive(PartialEq, Eq, Copy, Clone)]
|
||||||
#[allow(non_camel_case_types)]
|
|
||||||
#[repr(u8)]
|
#[repr(u8)]
|
||||||
pub enum PciCapabilityId {
|
pub enum PciCapabilityId {
|
||||||
ListId = 0,
|
ListId = 0,
|
||||||
@@ -532,7 +531,7 @@ pub enum Error {
|
|||||||
pub type Result<T> = result::Result<T, Error>;
|
pub type Result<T> = result::Result<T, Error>;
|
||||||
|
|
||||||
impl PciConfiguration {
|
impl PciConfiguration {
|
||||||
#[allow(clippy::too_many_arguments)]
|
#[expect(clippy::too_many_arguments)]
|
||||||
pub fn new(
|
pub fn new(
|
||||||
vendor_id: u16,
|
vendor_id: u16,
|
||||||
device_id: u16,
|
device_id: u16,
|
||||||
|
|||||||
@@ -615,8 +615,6 @@ impl VfioCommon {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// The `allocator` argument is unused on `aarch64`
|
|
||||||
#[allow(unused_variables)]
|
|
||||||
pub(crate) fn allocate_bars(
|
pub(crate) fn allocate_bars(
|
||||||
&mut self,
|
&mut self,
|
||||||
allocator: &mut SystemAllocator,
|
allocator: &mut SystemAllocator,
|
||||||
@@ -817,12 +815,9 @@ impl VfioCommon {
|
|||||||
bar_id += 1;
|
bar_id += 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(bars)
|
Ok(bars)
|
||||||
}
|
}
|
||||||
|
|
||||||
// The `allocator` argument is unused on `aarch64`
|
|
||||||
#[allow(unused_variables)]
|
|
||||||
pub(crate) fn free_bars(
|
pub(crate) fn free_bars(
|
||||||
&mut self,
|
&mut self,
|
||||||
allocator: &mut SystemAllocator,
|
allocator: &mut SystemAllocator,
|
||||||
@@ -1493,7 +1488,7 @@ pub struct VfioPciDevice {
|
|||||||
|
|
||||||
impl VfioPciDevice {
|
impl VfioPciDevice {
|
||||||
/// Constructs a new Vfio Pci device for the given Vfio device
|
/// Constructs a new Vfio Pci device for the given Vfio device
|
||||||
#[allow(clippy::too_many_arguments)]
|
#[expect(clippy::too_many_arguments)]
|
||||||
pub fn new(
|
pub fn new(
|
||||||
id: String,
|
id: String,
|
||||||
vm: Arc<dyn hypervisor::Vm>,
|
vm: Arc<dyn hypervisor::Vm>,
|
||||||
@@ -1790,7 +1785,6 @@ impl VfioPciDevice {
|
|||||||
// Only needed if p2p_dma is enabled.
|
// Only needed if p2p_dma is enabled.
|
||||||
if !self.iommu_attached && self.p2p_dma {
|
if !self.iommu_attached && self.p2p_dma {
|
||||||
// vfio_dma_map should be unsafe but isn't.
|
// vfio_dma_map should be unsafe but isn't.
|
||||||
#[allow(unused_unsafe)]
|
|
||||||
// SAFETY: MmapRegion invariants guarantee that
|
// SAFETY: MmapRegion invariants guarantee that
|
||||||
// user_memory_region.mapping.addr() points to
|
// user_memory_region.mapping.addr() points to
|
||||||
// user_memory_region.mapping.len() bytes of
|
// user_memory_region.mapping.len() bytes of
|
||||||
@@ -2037,7 +2031,6 @@ iova 0x{:x}, size 0x{:x}: {}, ",
|
|||||||
// Only needed if p2p_dma is enabled.
|
// Only needed if p2p_dma is enabled.
|
||||||
if !self.iommu_attached && self.p2p_dma {
|
if !self.iommu_attached && self.p2p_dma {
|
||||||
// vfio_dma_map is unsound and ought to be marked as unsafe
|
// vfio_dma_map is unsound and ought to be marked as unsafe
|
||||||
#[allow(unused_unsafe)]
|
|
||||||
// SAFETY: MmapRegion invariants guarantee that
|
// SAFETY: MmapRegion invariants guarantee that
|
||||||
// host_addr points to len bytes of
|
// host_addr points to len bytes of
|
||||||
// valid memory that will only be unmapped with munmap().
|
// valid memory that will only be unmapped with munmap().
|
||||||
@@ -2158,7 +2151,6 @@ impl<M: GuestAddressSpace + Sync + Send> ExternalDmaMapping for VfioDmaMapping<M
|
|||||||
};
|
};
|
||||||
|
|
||||||
// vfio_dma_map is unsound and ought to be marked as unsafe
|
// vfio_dma_map is unsound and ought to be marked as unsafe
|
||||||
#[allow(unused_unsafe)]
|
|
||||||
// SAFETY: find_user_address and GuestMemory::get_slice() guarantee that
|
// SAFETY: find_user_address and GuestMemory::get_slice() guarantee that
|
||||||
// the returned pointer is valid for up to `usize_size` bytes.
|
// the returned pointer is valid for up to `usize_size` bytes.
|
||||||
// `usize_size` is always equal to `size` due to the above `try_into()` call.
|
// `usize_size` is always equal to `size` due to the above `try_into()` call.
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ impl PciSubclass for PciVfioUserSubclass {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl VfioUserPciDevice {
|
impl VfioUserPciDevice {
|
||||||
#[allow(clippy::too_many_arguments)]
|
#[expect(clippy::too_many_arguments)]
|
||||||
pub fn new(
|
pub fn new(
|
||||||
id: String,
|
id: String,
|
||||||
vm: Arc<dyn hypervisor::Vm>,
|
vm: Arc<dyn hypervisor::Vm>,
|
||||||
|
|||||||
Reference in New Issue
Block a user