diff options
author | Albin Babu Varghese <albinbabuvarghese20@gmail.com> | 2025-05-27 16:49:28 -0400 |
---|---|---|
committer | Miguel Ojeda <ojeda@kernel.org> | 2025-06-24 01:01:12 +0200 |
commit | b61b0092eaf22ef34936516d2e7181bb9cee25ac (patch) | |
tree | 3f8383874bdc00085db7dba8ef8dc4fcef6ea0d8 /rust/kernel/workqueue.rs | |
parent | 5d4ffc531a642177362571ef946d950d37ff1259 (diff) |
rust: list: replace unwrap() with ? in doctest examples
Using `unwrap()` in kernel doctests can cause panics on error and may
give newcomers the mistaken impression that panicking is acceptable
in kernel code.
Replace all `.unwrap()` calls in `kernel::list`
examples with `.ok_or(EINVAL)?` so that errors are properly propagated.
Suggested-by: Miguel Ojeda <ojeda@kernel.org>
Link: https://github.com/Rust-for-Linux/linux/issues/1164
Reviewed-by: Benno Lossin <lossin@kernel.org>
Signed-off-by: Albin Babu Varghese <albinbabuvarghese20@gmail.com>
Reviewed-by: Alice Ryhl <aliceryhl@google.com>
Reviewed-by: Danilo Krummrich <dakr@kernel.org>
Link: https://lore.kernel.org/r/20250527204928.5117-1-albinbabuvarghese20@gmail.com
[ Reworded slightly. - Miguel ]
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
Diffstat (limited to 'rust/kernel/workqueue.rs')
0 files changed, 0 insertions, 0 deletions