lkml.org 
[lkml]   [2023]   [Mar]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH v2 4/6] rust: error: Add to_result() helper
From
On 3/29/23 09:04, Asahi Lina wrote:
> [...]
>
> +
> +/// Converts an integer as returned by a C kernel function to an error if it's negative, and
> +/// `Ok(())` otherwise.
> +pub fn to_result(err: core::ffi::c_int) -> Result {
> + if err < 0 {
> + Err(Error::from_errno(err))
> + } else {
> + Ok(())
> + }
> +}
>

Reviewed-by: Martin Rodriguez Reboredo

\
 
 \ /
  Last update: 2023-03-29 16:52    [W:0.215 / U:0.008 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site