summaryrefslogtreecommitdiff
path: root/rust
diff options
context:
space:
mode:
authorNicolás Antinori <nico.antinori.7@gmail.com>2026-06-29 17:10:41 -0300
committerJoerg Roedel <joerg.roedel@amd.com>2026-07-09 10:14:49 +0200
commite02e968159851cbb4deb2a0555ebaa3a6e7ced3b (patch)
treef41e932ffdbcb970d6621aefd73432abae7c7d9f /rust
parenteab000d501af568fe98d760f16eadd43d219df50 (diff)
downloadlinux-e02e968159851cbb4deb2a0555ebaa3a6e7ced3b.tar.gz
linux-e02e968159851cbb4deb2a0555ebaa3a6e7ced3b.zip
rust: iommu: replace core::mem::zeroed with Zeroable::zeroed
All types in `bindings` implement `Zeroable` if they can. This enables using `Zeroable::zeroed` for `io_pgtable_cfg` initialization instead of relying on `..unsafe { core::mem::zeroed() }`. This change improves readability and removes an unnecessary unsafe block. Link: https://github.com/Rust-for-Linux/linux/issues/1189 Suggested-by: Benno Lossin <lossin@kernel.org> Signed-off-by: Nicolás Antinori <nico.antinori.7@gmail.com> Acked-by: Gary Guo <gary@garyguo.net> Reviewed-by: Alice Ryhl <aliceryhl@google.com> Reviewed-by: Alexandre Courbot <acourbot@nvidia.com> Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Diffstat (limited to 'rust')
-rw-r--r--rust/kernel/iommu/pgtable.rs3
1 files changed, 1 insertions, 2 deletions
diff --git a/rust/kernel/iommu/pgtable.rs b/rust/kernel/iommu/pgtable.rs
index c88e38fd938a..eddda8d9d62a 100644
--- a/rust/kernel/iommu/pgtable.rs
+++ b/rust/kernel/iommu/pgtable.rs
@@ -102,8 +102,7 @@ impl<F: IoPageTableFmt> IoPageTable<F> {
coherent_walk: config.coherent_walk,
tlb: &raw const NOOP_FLUSH_OPS,
iommu_dev: dev.as_raw(),
- // SAFETY: All zeroes is a valid value for `struct io_pgtable_cfg`.
- ..unsafe { core::mem::zeroed() }
+ ..Zeroable::zeroed()
};
// SAFETY: