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-18 08:17:04 +00:00
committed by Alice Ryhl
parent a625a898ea
commit 97cf6bc0ab
+1 -3
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);