From: Benno Lossin All types in `bindings` implement `Zeroable` if they can, so use `pin_init::zeroed` instead of relying on `unsafe` code. If this ends up not compiling in the future, something in bindgen or on the C side changed and is most likely incorrect. Link: https://github.com/Rust-for-Linux/linux/issues/1189 Suggested-by: Benno Lossin Signed-off-by: Yizhe Sun --- rust/kernel/net/phy.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/rust/kernel/net/phy.rs b/rust/kernel/net/phy.rs index bf6272d87a7b..46c693c5768a 100644 --- a/rust/kernel/net/phy.rs +++ b/rust/kernel/net/phy.rs @@ -553,9 +553,7 @@ pub const fn create_phy_driver() -> DriverVTable { } else { None }, - // SAFETY: The rest is zeroed out to initialize `struct phy_driver`, - // sets `Option<&F>` to be `None`. - ..unsafe { core::mem::MaybeUninit::::zeroed().assume_init() } + ..pin_init::zeroed() })) } -- 2.51.1