diff options
Diffstat (limited to 'rust')
| -rw-r--r-- | rust/kernel/net/phy.rs | 7 | 
1 files changed, 2 insertions, 5 deletions
| diff --git a/rust/kernel/net/phy.rs b/rust/kernel/net/phy.rs index 7de5cc7a0eee..c895582cd624 100644 --- a/rust/kernel/net/phy.rs +++ b/rust/kernel/net/phy.rs @@ -196,11 +196,8 @@ impl Device {          // SAFETY: `phydev` is pointing to a valid object by the type invariant of `Self`.          // So it's just an FFI call.          let ret = unsafe { bindings::phy_read_paged(phydev, page.into(), regnum.into()) }; -        if ret < 0 { -            Err(Error::from_errno(ret)) -        } else { -            Ok(ret as u16) -        } + +        to_result(ret).map(|()| ret as u16)      }      /// Resolves the advertisements into PHY settings. | 
