Re: [PATCH v2] rust: error: clarify that `from_err_ptr` can return `Ok(NULL)`
From: Alice Ryhl
Date: Wed Apr 01 2026 - 15:51:36 EST
On Sun, Mar 29, 2026 at 12:45 PM Mirko Adzic <adzicmirko97@xxxxxxxxx> wrote:
>
> 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@xxxxxxxxxx>
> Link: https://lore.kernel.org/rust-for-linux/20260322193830.89324-1-ojeda@xxxxxxxxxx/
> Link: https://github.com/Rust-for-Linux/linux/issues/1231
> Signed-off-by: Mirko Adzic <adzicmirko97@xxxxxxxxx>
Reviewed-by: Alice Ryhl <aliceryhl@xxxxxxxxxx>