kernel: riscv: fix warnings in process

Fix clippy warnings in the `process.rs` file.

Signed-off-by: Sean Cross <sean@xobs.io>
This commit is contained in:
Sean Cross 2021-08-06 12:54:43 +08:00
parent dbd34318ce
commit 68f5e81d3f

View file

@ -378,7 +378,7 @@ impl Process {
// println!("Setting up thread {}, pid {}", new_tid, pid);
let sp = setup.stack.as_ptr() as usize + setup.stack.len();
if sp <= 16 {
Err(xous_kernel::Error::BadAddress)?;
return Err(xous_kernel::Error::BadAddress);
}
crate::arch::syscall::invoke(
thread,
@ -403,7 +403,7 @@ impl Process {
// Ensure this thread is valid
if thread.sepc == 0 || tid == IRQ_TID {
Err(xous_kernel::Error::ThreadNotAvailable)?;
return Err(xous_kernel::Error::ThreadNotAvailable);
}
// thread.registers[0] == x1
@ -425,7 +425,6 @@ impl Process {
pub fn print_all_threads(&self) {
let process = unsafe { &mut *PROCESS };
&mut process.threads[process.hardware_thread - 1];
for (tid_idx, &thread) in process.threads.iter().enumerate() {
let tid = tid_idx + 1;
if thread.registers[1] != 0 {
@ -437,7 +436,7 @@ impl Process {
pub fn print_current_thread(&self) {
let thread = self.current_thread();
let tid = self.current_tid();
Self::print_thread(tid, &thread);
Self::print_thread(tid, thread);
}
pub fn print_thread(_tid: TID, _thread: &Thread) {