mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
devices: Fix clippy: unneeded late initialization
```
warning: unneeded late initialization
--> devices/src/legacy/gpio_pl061.rs:258:9
|
258 | let value;
| ^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_late_init
= note: `-D clippy::needless-late-init` implied by `-D clippy::all`
```
Signed-off-by: Rob Bradford <rbradford@meta.com>
This commit is contained in:
@@ -255,16 +255,15 @@ impl Gpio {
|
||||
|
||||
impl BusDevice for Gpio {
|
||||
fn read(&mut self, _base: u64, offset: u64, data: &mut [u8]) {
|
||||
let value;
|
||||
let mut read_ok = true;
|
||||
|
||||
if (GPIO_ID_LOW..GPIO_ID_HIGH).contains(&offset) {
|
||||
let value = if (GPIO_ID_LOW..GPIO_ID_HIGH).contains(&offset) {
|
||||
let index = ((offset - GPIO_ID_LOW) >> 2) as usize;
|
||||
value = u32::from(GPIO_ID[index]);
|
||||
u32::from(GPIO_ID[index])
|
||||
} else if offset < OFS_DATA {
|
||||
value = self.data & ((offset >> 2) as u32);
|
||||
self.data & ((offset >> 2) as u32)
|
||||
} else {
|
||||
value = match offset {
|
||||
match offset {
|
||||
GPIODIR => self.dir,
|
||||
GPIOIS => self.isense,
|
||||
GPIOIBE => self.ibe,
|
||||
@@ -277,8 +276,8 @@ impl BusDevice for Gpio {
|
||||
read_ok = false;
|
||||
0
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
if read_ok && data.len() <= 4 {
|
||||
write_le_u32(data, value);
|
||||
|
||||
Reference in New Issue
Block a user