Skip to content

Commit a3f143c

Browse files
weirdsmileyaxboe
authored andcommitted
rust: block: simplify Result<()> in validate_block_size return
`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 <[email protected]> Link: Rust-for-Linux#1128 Signed-off-by: Manas <[email protected]> Reviewed-by: Miguel Ojeda <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
1 parent 88d47f6 commit a3f143c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

rust/kernel/block/mq/gen_disk.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ impl GenDiskBuilder {
4545

4646
/// Validate block size by verifying that it is between 512 and `PAGE_SIZE`,
4747
/// and that it is a power of two.
48-
fn validate_block_size(size: u32) -> Result<()> {
48+
fn validate_block_size(size: u32) -> Result {
4949
if !(512..=bindings::PAGE_SIZE as u32).contains(&size) || !size.is_power_of_two() {
5050
Err(error::code::EINVAL)
5151
} else {

0 commit comments

Comments
 (0)