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:
Rob Bradford
2026-07-06 23:47:00 +01:00
parent 52f5d5fc9a
commit 854bd6bf65

View File

@@ -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);