Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

Atharv Dubey and committed by
Alice Ryhl
97cf6bc0 a625a898

+1 -3
+1 -3
rust/kernel/drm/gem/mod.rs
··· 293 293 } 294 294 295 295 pub(super) const fn create_fops() -> bindings::file_operations { 296 - // SAFETY: As by the type invariant, it is safe to initialize `bindings::file_operations` 297 - // zeroed. 298 - let mut fops: bindings::file_operations = unsafe { core::mem::zeroed() }; 296 + let mut fops: bindings::file_operations = pin_init::zeroed(); 299 297 300 298 fops.owner = core::ptr::null_mut(); 301 299 fops.open = Some(bindings::drm_open);