misc: clippy: add redundant_else

Signed-off-by: Philipp Schuster <philipp.schuster@cyberus-technology.de>
On-behalf-of: SAP philipp.schuster@sap.com
This commit is contained in:
Philipp Schuster
2025-11-18 12:30:49 +01:00
committed by Rob Bradford
parent d2b19bb969
commit a0b72dce22
10 changed files with 51 additions and 60 deletions

View File

@@ -726,17 +726,16 @@ impl VcpuState {
loop {
if self.vcpu_run_interrupted.load(Ordering::SeqCst) {
return Ok(());
} else {
// This is more effective than thread::yield_now() at
// avoiding a priority inversion with the vCPU thread
thread::sleep(std::time::Duration::from_millis(1));
count += 1;
if count >= 1000 {
return Err(Error::SignalAcknowledgeTimeout);
} else if count % 10 == 0 {
warn!("vCPU thread did not respond in {count}ms to signal - retrying");
self.signal_thread();
}
}
// This is more effective than thread::yield_now() at
// avoiding a priority inversion with the vCPU thread
thread::sleep(std::time::Duration::from_millis(1));
count += 1;
if count >= 1000 {
return Err(Error::SignalAcknowledgeTimeout);
} else if count % 10 == 0 {
warn!("vCPU thread did not respond in {count}ms to signal - retrying");
self.signal_thread();
}
}
}
@@ -807,21 +806,20 @@ impl CpuManager {
if amx_tile != 0 {
return Err(Error::AmxEnable(anyhow!("Guest AMX usage not supported")));
} else {
let mut mask: usize = 0;
// SAFETY: Syscall with valid parameters. We use a raw mutable pointer to
// the `mask` place in order to ensure that we do not violate Rust's
// aliasing rules.
let result = unsafe {
libc::syscall(
libc::SYS_arch_prctl,
ARCH_GET_XCOMP_GUEST_PERM,
&raw mut mask,
)
};
if result != 0 || (mask & XFEATURE_XTILEDATA_MASK) != XFEATURE_XTILEDATA_MASK {
return Err(Error::AmxEnable(anyhow!("Guest AMX usage not supported")));
}
}
let mut mask: usize = 0;
// SAFETY: Syscall with valid parameters. We use a raw mutable pointer to
// the `mask` place in order to ensure that we do not violate Rust's
// aliasing rules.
let result = unsafe {
libc::syscall(
libc::SYS_arch_prctl,
ARCH_GET_XCOMP_GUEST_PERM,
&raw mut mask,
)
};
if result != 0 || (mask & XFEATURE_XTILEDATA_MASK) != XFEATURE_XTILEDATA_MASK {
return Err(Error::AmxEnable(anyhow!("Guest AMX usage not supported")));
}
}

View File

@@ -289,9 +289,8 @@ impl SerialManager {
// be considered as a regular error. Instead it is more
// appropriate to retry, by calling into epoll_wait().
continue;
} else {
return Err(Error::Epoll(e));
}
return Err(Error::Epoll(e));
}
};

View File

@@ -1743,14 +1743,13 @@ impl Vm {
zone.hotplugged_size = Some(hotplugged_size);
return Ok(());
} else {
error!(
"Invalid to ask less ({}) than boot RAM ({}) for \
this memory zone",
desired_memory, zone.size,
);
return Err(Error::ResizeZone);
}
error!(
"Invalid to ask less ({}) than boot RAM ({}) for \
this memory zone",
desired_memory, zone.size,
);
return Err(Error::ResizeZone);
}
}
}