From 4ace363abcd6af29e49a8ef8d259a05a71aed018 Mon Sep 17 00:00:00 2001 From: bunnie Date: Tue, 9 Apr 2024 18:23:09 +0800 Subject: [PATCH] this resolves comments from @xobs' code review --- libs/cramium-hal/src/udma.rs | 6 +----- loader/src/main.rs | 2 +- tools/src/bin/create-image.rs | 2 +- 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/libs/cramium-hal/src/udma.rs b/libs/cramium-hal/src/udma.rs index 5c7a31602..c1dbdc2c5 100644 --- a/libs/cramium-hal/src/udma.rs +++ b/libs/cramium-hal/src/udma.rs @@ -1035,11 +1035,7 @@ impl Spim { } while words_sent < total_words { // determine the valid length of data we could send - let tx_len = if (total_words - words_sent) >= self.tx_buf_len_bytes as usize { - self.tx_buf_len_bytes - } else { - total_words - words_sent - }; + let tx_len = (total_words - words_sent).min(self.tx_buf_len_bytes); // setup the command list for data to send let cmd_list = [SpimCmd::TxData( self.mode, diff --git a/loader/src/main.rs b/loader/src/main.rs index 06d9361e1..1938f49dc 100644 --- a/loader/src/main.rs +++ b/loader/src/main.rs @@ -134,7 +134,7 @@ fn boot_sequence(args: KernelArguments, _signature: u32, fs_prehash: [u8; 64]) - cfg.swap_hal = SwapHal::new(&cfg); read_swap_config(&mut cfg); #[cfg(feature = "resume")] - println!( + compile_error!( "WARNING WARNING WARNING: swap and resume selected - this is not a valid configuration because\ the stack overlaps into the 'clean suspend' marker with swap. This needs to be fixed if resume is desired with swap." ); diff --git a/tools/src/bin/create-image.rs b/tools/src/bin/create-image.rs index b8797cb2d..9cee9d0e3 100644 --- a/tools/src/bin/create-image.rs +++ b/tools/src/bin/create-image.rs @@ -431,7 +431,7 @@ fn main() { } if let Some(init_paths) = matches.values_of("inis") { - if let Some(ref mut sargs) = swap_args { + if let Some(sargs) = &mut swap_args { for init_path in init_paths { let program_name = std::path::Path::new(init_path); process_names.set(