rust/kernel/uaccess.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
The `kernel` prelude brings `Result` and the error codes; and the prelude
itself is already available in the examples automatically.
In addition, `Result` already defaults to `T = ()`.
Thus simplify.
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
---
A quick thing I noticed looking at something else...
rust/kernel/uaccess.rs | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/rust/kernel/uaccess.rs b/rust/kernel/uaccess.rs
index 80a9782b1c6e..7e4c953ba8a1 100644
--- a/rust/kernel/uaccess.rs
+++ b/rust/kernel/uaccess.rs
@@ -46,10 +46,9 @@
///
/// ```no_run
/// use kernel::ffi::c_void;
-/// use kernel::error::Result;
/// use kernel::uaccess::{UserPtr, UserSlice};
///
-/// fn bytes_add_one(uptr: UserPtr, len: usize) -> Result<()> {
+/// fn bytes_add_one(uptr: UserPtr, len: usize) -> Result {
/// let (read, mut write) = UserSlice::new(uptr, len).reader_writer();
///
/// let mut buf = KVec::new();
@@ -68,7 +67,6 @@
///
/// ```no_run
/// use kernel::ffi::c_void;
-/// use kernel::error::{code::EINVAL, Result};
/// use kernel::uaccess::{UserPtr, UserSlice};
///
/// /// Returns whether the data in this region is valid.
base-commit: b4432656b36e5cc1d50a1f2dc15357543add530e
--
2.49.0
On Tue, Apr 29, 2025 at 5:15 PM Miguel Ojeda <ojeda@kernel.org> wrote: > > The `kernel` prelude brings `Result` and the error codes; and the prelude > itself is already available in the examples automatically. > > In addition, `Result` already defaults to `T = ()`. > > Thus simplify. > > Signed-off-by: Miguel Ojeda <ojeda@kernel.org> Applied to `rust-next` -- thanks! Cheers, Miguel
On Tue, Apr 29, 2025 at 05:14:45PM +0200, Miguel Ojeda wrote: > The `kernel` prelude brings `Result` and the error codes; and the prelude > itself is already available in the examples automatically. > > In addition, `Result` already defaults to `T = ()`. > > Thus simplify. > > Signed-off-by: Miguel Ojeda <ojeda@kernel.org> Reviewed-by: Alice Ryhl <aliceryhl@google.com>
© 2016 - 2026 Red Hat, Inc.