From 68f5e81d3f2f24363042ea0d9cae25f89b456d97 Mon Sep 17 00:00:00 2001 From: Sean Cross Date: Fri, 6 Aug 2021 12:54:43 +0800 Subject: [PATCH] kernel: riscv: fix warnings in `process` Fix clippy warnings in the `process.rs` file. Signed-off-by: Sean Cross --- kernel/src/arch/riscv/process.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/kernel/src/arch/riscv/process.rs b/kernel/src/arch/riscv/process.rs index 5b43f94d0..291ba6a0d 100644 --- a/kernel/src/arch/riscv/process.rs +++ b/kernel/src/arch/riscv/process.rs @@ -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) {