mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
pci: Reduce use of magic number 4
No functional change intended. Signed-off-by: Demi Marie Obenour <demiobenour@gmail.com>
This commit is contained in:
committed by
Rob Bradford
parent
68ae56eb74
commit
8b86dd9fb5
@@ -987,7 +987,7 @@ impl PciConfiguration {
|
||||
return None;
|
||||
}
|
||||
|
||||
let bar_idx = reg_idx - 4;
|
||||
let bar_idx = reg_idx - BAR0_REG;
|
||||
// Handle special case where the address being written is
|
||||
// different from the address initially provided. This is a
|
||||
// BAR reprogramming case which needs to be properly caught.
|
||||
@@ -1025,7 +1025,7 @@ impl PciConfiguration {
|
||||
len,
|
||||
region_type,
|
||||
});
|
||||
} else if (reg_idx > BAR0_REG)
|
||||
} else if (bar_idx > 0)
|
||||
&& ((self.registers[reg_idx - 1] & self.writable_bits[reg_idx - 1])
|
||||
!= (self.bars[bar_idx - 1].addr & self.writable_bits[reg_idx - 1])
|
||||
|| (value & mask) != (self.bars[bar_idx].addr & mask))
|
||||
|
||||
Reference in New Issue
Block a user