Hi Atharv,

> On 1 Dec 2025, at 12:27, Atharv Dubey <[email protected]> wrote:
> 
> 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 <[email protected]>
> ---
> rust/kernel/drm/gem/mod.rs | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/rust/kernel/drm/gem/mod.rs b/rust/kernel/drm/gem/mod.rs
> index 30c853988b94..f9fd98dc102b 100644
> --- a/rust/kernel/drm/gem/mod.rs
> +++ b/rust/kernel/drm/gem/mod.rs
> @@ -298,9 +298,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);
> -- 
> 2.43.0
> 
> 

I wonder if this should be part of a larger series that implements this change
throughout the tree?

— Daniel

Reply via email to