rust: error: clarify that `from_err_ptr` can return `Ok(NULL)`
Improve the doc comment of `from_err_ptr` by explicitly stating that it
will return `Ok(NULL)` when passed a null pointer, as it isn't an error
value.
Add a doctest case that tests the behavior described above, as well as
other scenarios (non-null/non-error pointer, error value).
Suggested-by: Miguel Ojeda <ojeda@kernel.org>
Link: https://lore.kernel.org/rust-for-linux/20260322193830.89324-1-ojeda@kernel.org/
Link: https://github.com/Rust-for-Linux/linux/issues/1231
Signed-off-by: Mirko Adzic <adzicmirko97@gmail.com>
Reviewed-by: Alice Ryhl <aliceryhl@google.com>
Link: https://patch.msgid.link/20260329104319.131057-1-adzicmirko97@gmail.com
[ - Added `expect` for `clippy::missing_safety_doc`.
- Simplified and removed unsafe block using `Error::to_ptr()`.
- Added intra-doc link.
- Miguel ]
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>