summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAtharv Dubey <atharvd440@gmail.com>2025-12-01 20:57:58 +0530
committerAlice Ryhl <aliceryhl@google.com>2025-12-18 08:17:04 +0000
commit97cf6bc0abd381fd84e5d8e978322a62a58fb00e (patch)
tree99302e43bb6cfa2cab4032ae5d5912f63d7c1cfc
parenta625a898ea8f74ca0bb55c6e0c2fcff80edb1068 (diff)
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>
-rw-r--r--rust/kernel/drm/gem/mod.rs4
1 files changed, 1 insertions, 3 deletions
diff --git a/rust/kernel/drm/gem/mod.rs b/rust/kernel/drm/gem/mod.rs
index 76e6c40d525e..bdaac839dacc 100644
--- a/rust/kernel/drm/gem/mod.rs
+++ b/rust/kernel/drm/gem/mod.rs
@@ -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);