* [PATCH] rust: drm: use `pin_init::zeroed()` for file operations initialization
@ 2025-11-29 13:48 Atharv Dubey
2025-11-29 14:30 ` Miguel Ojeda
0 siblings, 1 reply; 3+ messages in thread
From: Atharv Dubey @ 2025-11-29 13:48 UTC (permalink / raw)
To: airlied, simona, dakr, aliceryhl, ojeda, alex.gaynor
Cc: boqun.feng, gary, bjorn3_gh, lossin, a.hindborg, tmgross,
daniel.almeida, lyude, shankari.ak0208, lina+kernel, dri-devel,
rust-for-linux, linux-kernel, Atharv Dubey
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>
---
rust/kernel/drm/gem/mod.rs | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/rust/kernel/drm/gem/mod.rs b/rust/kernel/drm/gem/mod.rs
index 30c853988b94..c220cf1966fd 100644
--- a/rust/kernel/drm/gem/mod.rs
+++ b/rust/kernel/drm/gem/mod.rs
@@ -298,9 +298,8 @@ 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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] rust: drm: use `pin_init::zeroed()` for file operations initialization
2025-11-29 13:48 [PATCH] rust: drm: use `pin_init::zeroed()` for file operations initialization Atharv Dubey
@ 2025-11-29 14:30 ` Miguel Ojeda
2025-12-01 14:27 ` Atharv Dubey
0 siblings, 1 reply; 3+ messages in thread
From: Miguel Ojeda @ 2025-11-29 14:30 UTC (permalink / raw)
To: Atharv Dubey
Cc: airlied, simona, dakr, aliceryhl, ojeda, alex.gaynor, boqun.feng,
gary, bjorn3_gh, lossin, a.hindborg, tmgross, daniel.almeida,
lyude, shankari.ak0208, lina+kernel, dri-devel, rust-for-linux,
linux-kernel
On Sat, Nov 29, 2025 at 2:48 PM Atharv Dubey <atharvd440@gmail.com> wrote:
>
> +
Spurious newline?
Cheers,
Miguel
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] rust: drm: use `pin_init::zeroed()` for file operations initialization
2025-11-29 14:30 ` Miguel Ojeda
@ 2025-12-01 14:27 ` Atharv Dubey
0 siblings, 0 replies; 3+ messages in thread
From: Atharv Dubey @ 2025-12-01 14:27 UTC (permalink / raw)
To: Miguel Ojeda
Cc: airlied, simona, dakr, aliceryhl, ojeda, alex.gaynor, boqun.feng,
gary, bjorn3_gh, lossin, a.hindborg, tmgross, daniel.almeida,
lyude, shankari.ak0208, lina+kernel, dri-devel, rust-for-linux,
linux-kernel
On Sat, Nov 29, 2025 at 03:30:53PM +0100, Miguel Ojeda wrote:
> On Sat, Nov 29, 2025 at 2:48 PM Atharv Dubey <atharvd440@gmail.com> wrote:
> >
> > +
>
> Spurious newline?
> > Sorry for this, I will send a V2 of the patch.
> Cheers,
> Miguel
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-12-01 14:27 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-29 13:48 [PATCH] rust: drm: use `pin_init::zeroed()` for file operations initialization Atharv Dubey
2025-11-29 14:30 ` Miguel Ojeda
2025-12-01 14:27 ` Atharv Dubey
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).