rust: drm: use pin_init::zeroed() for file operations initialization

Replace the manual `unsafe { core::mem::zeroed() }` initialization of
`bindings::file_operations` with `pin_init::zeroed()`. This removes the
explicit unsafe

Signed-off-by: Atharv Dubey <atharvd440@gmail.com>
Link: https://patch.msgid.link/20251201152759.16429-1-atharvd440@gmail.com
Signed-off-by: Alice Ryhl <aliceryhl@google.com>
This commit is contained in:
Atharv Dubey 2025-12-01 20:57:58 +05:30 committed by Alice Ryhl
parent a625a898ea
commit 97cf6bc0ab

View File

@ -293,9 +293,7 @@ impl<T: DriverObject> AllocImpl for Object<T> {
}
pub(super) const fn create_fops() -> bindings::file_operations {
// SAFETY: As by the type invariant, it is safe to initialize `bindings::file_operations`
// zeroed.
let mut fops: bindings::file_operations = unsafe { core::mem::zeroed() };
let mut fops: bindings::file_operations = pin_init::zeroed();
fops.owner = core::ptr::null_mut();
fops.open = Some(bindings::drm_open);