From e02e968159851cbb4deb2a0555ebaa3a6e7ced3b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Antinori?= Date: Mon, 29 Jun 2026 17:10:41 -0300 Subject: [PATCH] rust: iommu: replace core::mem::zeroed with Zeroable::zeroed MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Signed-off-by: Nicolás Antinori Acked-by: Gary Guo Reviewed-by: Alice Ryhl Reviewed-by: Alexandre Courbot Signed-off-by: Joerg Roedel --- rust/kernel/iommu/pgtable.rs | 3 +-- 1 file changed, 1 insertion(+), 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 IoPageTable { 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: