Message ID | 20241118-simplify-result-v3-1-6b1566a77eab@iiitd.ac.in (mailing list archive) |
---|---|
State | Not Applicable |
Headers | show |
Series | rust: simplify Result<()> uses | expand |
Context | Check | Description |
---|---|---|
netdev/tree_selection | success | Not a local patch |
On Mon, Nov 18, 2024 at 3:37 PM Manas via B4 Relay <devnull+manas18244.iiitd.ac.in@kernel.org> wrote: > > From: Manas <manas18244@iiitd.ac.in> > > `Result` is used in place of `Result<()>` because the default type > parameters are unit `()` and `Error` types, which are automatically > inferred. Thus keep the usage consistent throughout codebase. > > Suggested-by: Miguel Ojeda <ojeda@kernel.org> > Link: https://github.com/Rust-for-Linux/linux/issues/1128 > Signed-off-by: Manas <manas18244@iiitd.ac.in> If block wants to pick this one up independently: Reviewed-by: Miguel Ojeda <ojeda@kernel.org> (Note: normally you would carry the review/tested tags you were given in a previous version, unless you made significant changes) Thanks! Cheers, Miguel
On 11/18/24 9:05 AM, Miguel Ojeda wrote: > On Mon, Nov 18, 2024 at 3:37?PM Manas via B4 Relay > <devnull+manas18244.iiitd.ac.in@kernel.org> wrote: >> >> From: Manas <manas18244@iiitd.ac.in> >> >> `Result` is used in place of `Result<()>` because the default type >> parameters are unit `()` and `Error` types, which are automatically >> inferred. Thus keep the usage consistent throughout codebase. >> >> Suggested-by: Miguel Ojeda <ojeda@kernel.org> >> Link: https://github.com/Rust-for-Linux/linux/issues/1128 >> Signed-off-by: Manas <manas18244@iiitd.ac.in> > > If block wants to pick this one up independently: > > Reviewed-by: Miguel Ojeda <ojeda@kernel.org> I can grab it.
On 18.11.2024 17:05, Miguel Ojeda wrote: >On Mon, Nov 18, 2024 at 3:37 PM Manas via B4 Relay ><devnull+manas18244.iiitd.ac.in@kernel.org> wrote: >> >> From: Manas <manas18244@iiitd.ac.in> >> >> `Result` is used in place of `Result<()>` because the default type >> parameters are unit `()` and `Error` types, which are automatically >> inferred. Thus keep the usage consistent throughout codebase. >> >> Suggested-by: Miguel Ojeda <ojeda@kernel.org> >> Link: https://github.com/Rust-for-Linux/linux/issues/1128 >> Signed-off-by: Manas <manas18244@iiitd.ac.in> > >If block wants to pick this one up independently: > >Reviewed-by: Miguel Ojeda <ojeda@kernel.org> > >(Note: normally you would carry the review/tested tags you were given >in a previous version, unless you made significant changes) Thanks. I will keep that in mind.
diff --git a/rust/kernel/block/mq/gen_disk.rs b/rust/kernel/block/mq/gen_disk.rs index 708125dce96a934f32caab44d5e6cff14c4321a9..798c4ae0bdedd58221b5851a630c0e1052e0face 100644 --- a/rust/kernel/block/mq/gen_disk.rs +++ b/rust/kernel/block/mq/gen_disk.rs @@ -45,7 +45,7 @@ pub fn rotational(mut self, rotational: bool) -> Self { /// Validate block size by verifying that it is between 512 and `PAGE_SIZE`, /// and that it is a power of two. - fn validate_block_size(size: u32) -> Result<()> { + fn validate_block_size(size: u32) -> Result { if !(512..=bindings::PAGE_SIZE as u32).contains(&size) || !size.is_power_of_two() { Err(error::code::EINVAL) } else {