mirror of
https://github.com/torvalds/linux.git
synced 2026-05-29 17:43:52 +02:00
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:
parent
a625a898ea
commit
97cf6bc0ab
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user