mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
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:
committed by
Rob Bradford
parent
d2b19bb969
commit
a0b72dce22
@@ -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")));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user