struct map_ops has only function pointers, so CONFIG_RANDSTRUCT
randomizes its layout and it can't be initialized positionally. Builds
with RANDSTRUCT fail on both tables:

  drivers/gpu/drm/msm/msm_iommu.c:228:2: error: a randomized struct can only be 
initialized with a designated initializer
  drivers/gpu/drm/msm/msm_iommu.c:762:2: error: a randomized struct can only be 
initialized with a designated initializer

allmodconfig selects RANDSTRUCT_FULL when the compiler supports it and
no Rust toolchain is available, so KernelCI's allmodconfig builds
fail too.

Use designated initializers.

Fixes: aa20cf2a2960 ("drm/msm: Extract out map/unmap helpers")
Fixes: 1600c10eeda0 ("drm/msm: Convert iommu map/unmap to helpers")
Reported-by: kernel test robot <[email protected]>
Closes: 
https://lore.kernel.org/oe-kbuild-all/[email protected]/
Signed-off-by: Sasha Levin <[email protected]>
---
Built drivers/gpu/drm/msm/msm_iommu.o with clang 21, x86_64 allmodconfig and
CONFIG_RANDSTRUCT_FULL=y on top of msm-next: fails before, builds after.

 drivers/gpu/drm/msm/msm_iommu.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/msm/msm_iommu.c b/drivers/gpu/drm/msm/msm_iommu.c
index cc0856d4817d7..55655f25a1c75 100644
--- a/drivers/gpu/drm/msm/msm_iommu.c
+++ b/drivers/gpu/drm/msm/msm_iommu.c
@@ -225,7 +225,9 @@ __flush_pgtable(void *arg)
 }
 
 static const struct map_ops pgtable_ops = {
-       __unmap_pgtable, __map_pgtable, __flush_pgtable
+       .unmap = __unmap_pgtable,
+       .map = __map_pgtable,
+       .flush = __flush_pgtable,
 };
 
 static int msm_iommu_pagetable_unmap(struct msm_mmu *mmu, u64 iova, size_t 
size)
@@ -759,7 +761,9 @@ __flush_iommu(void *arg)
 }
 
 static const struct map_ops iommu_ops = {
-       __unmap_iommu, __map_iommu, __flush_iommu
+       .unmap = __unmap_iommu,
+       .map = __map_iommu,
+       .flush = __flush_iommu,
 };
 
 static int msm_iommu_map(struct msm_mmu *mmu, uint64_t iova,

base-commit: dca2f1b25860f8caa0406f858e76a3a21671a012
-- 
2.53.0

Reply via email to