diff options
| author | Wedson Almeida Filho <[email protected]> | 2023-04-03 09:48:13 +0000 |
|---|---|---|
| committer | Miguel Ojeda <[email protected]> | 2023-04-12 16:41:04 +0000 |
| commit | 086fbfa3b328901fa8b369093ba468864e20544e (patch) | |
| tree | d0dffc6df92019dd32b6ffb5eca65306241a32e1 /rust/helpers.c | |
| parent | rust: error: Add Error::from_errno{_unchecked}() (diff) | |
| download | kernel-086fbfa3b328901fa8b369093ba468864e20544e.tar.gz kernel-086fbfa3b328901fa8b369093ba468864e20544e.zip | |
rust: error: Add to_result() helper
Add a to_result() helper to convert kernel C return values to a Rust
Result, mapping >=0 values to Ok(()) and negative values to Err(...),
with Error::from_errno() ensuring that the errno is within range.
Lina: Imported from rust-for-linux/rust, originally developed by Wedson
as part of the AMBA device driver support.
Signed-off-by: Wedson Almeida Filho <[email protected]>
Reviewed-by: Andreas Hindborg <[email protected]>
Reviewed-by: Gary Guo <[email protected]>
Reviewed-by: Martin Rodriguez Reboredo <[email protected]>
Signed-off-by: Asahi Lina <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
[ Add a removal of `#[allow(dead_code)]`. ]
Signed-off-by: Miguel Ojeda <[email protected]>
Diffstat (limited to 'rust/helpers.c')
0 files changed, 0 insertions, 0 deletions
