diff options
| author | Asahi Lina <[email protected]> | 2023-04-03 09:48:11 +0000 |
|---|---|---|
| committer | Miguel Ojeda <[email protected]> | 2023-04-12 16:41:04 +0000 |
| commit | c7e20faa5fcad7a177cf6c306138010343dd6d3e (patch) | |
| tree | db1b09d4b29aaaee63801fb656dc1f4bf9a658e5 /rust/helpers.c | |
| parent | rust: error: Rename to_kernel_errno() -> to_errno() (diff) | |
| download | kernel-c7e20faa5fcad7a177cf6c306138010343dd6d3e.tar.gz kernel-c7e20faa5fcad7a177cf6c306138010343dd6d3e.zip | |
rust: error: Add Error::to_ptr()
This is the Rust equivalent to ERR_PTR(), for use in C callbacks.
Marked as #[allow(dead_code)] for now, since it does not have any
consumers yet.
Reviewed-by: Martin Rodriguez Reboredo <[email protected]>
Signed-off-by: Asahi Lina <[email protected]>
Reviewed-by: Gary Guo <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Miguel Ojeda <[email protected]>
Diffstat (limited to 'rust/helpers.c')
| -rw-r--r-- | rust/helpers.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/rust/helpers.c b/rust/helpers.c index 09a4d93f9d62..89f4cd1e0df3 100644 --- a/rust/helpers.c +++ b/rust/helpers.c @@ -20,6 +20,7 @@ #include <linux/bug.h> #include <linux/build_bug.h> +#include <linux/err.h> #include <linux/refcount.h> __noreturn void rust_helper_BUG(void) @@ -46,6 +47,12 @@ bool rust_helper_refcount_dec_and_test(refcount_t *r) } EXPORT_SYMBOL_GPL(rust_helper_refcount_dec_and_test); +__force void *rust_helper_ERR_PTR(long err) +{ + return ERR_PTR(err); +} +EXPORT_SYMBOL_GPL(rust_helper_ERR_PTR); + /* * We use `bindgen`'s `--size_t-is-usize` option to bind the C `size_t` type * as the Rust `usize` type, so we can use it in contexts where Rust |
