misc: Fix clippy issues

Signed-off-by: Bo Chen <chen.bo@intel.com>
This commit is contained in:
Bo Chen
2022-11-01 14:52:40 -07:00
committed by Sebastien Boeuf
parent 9266ea4995
commit a9ec0f33c0
35 changed files with 78 additions and 92 deletions

View File

@@ -413,7 +413,7 @@ impl VfioCommon {
resources: Option<Vec<Resource>>,
) -> Result<Vec<PciBarConfiguration>, PciDeviceError> {
let mut bars = Vec::new();
let mut bar_id = VFIO_PCI_BAR0_REGION_INDEX as u32;
let mut bar_id = VFIO_PCI_BAR0_REGION_INDEX;
// Going through all regular regions to compute the BAR size.
// We're not saving the BAR address to restore it, because we
@@ -526,7 +526,7 @@ impl VfioCommon {
}
// Invert and add 1 to to find size
region_size = (!combined_size + 1) as u64;
region_size = !combined_size + 1;
} else {
region_type = PciBarRegionType::Memory32BitRegion;
@@ -599,7 +599,7 @@ impl VfioCommon {
start: bar_addr,
length: region_size,
type_: region_type,
index: bar_id as u32,
index: bar_id,
user_memory_regions: Vec::new(),
});

View File

@@ -276,12 +276,7 @@ impl VfioUserPciDevice {
self.client
.lock()
.unwrap()
.dma_map(
offset,
region.start_addr().raw_value(),
region.len() as u64,
fd,
)
.dma_map(offset, region.start_addr().raw_value(), region.len(), fd)
.map_err(VfioUserPciDeviceError::DmaMap)
}
@@ -292,7 +287,7 @@ impl VfioUserPciDevice {
self.client
.lock()
.unwrap()
.dma_unmap(region.start_addr().raw_value(), region.len() as u64)
.dma_unmap(region.start_addr().raw_value(), region.len())
.map_err(VfioUserPciDeviceError::DmaUnmap)
}
}