Skip to content

Commit c626f38

Browse files
nathanchancedaeinki
authored andcommitted
drm/exynos: Always initialize mapping in exynos_drm_register_dma()
In certain randconfigs, clang warns: drivers/gpu/drm/exynos/exynos_drm_dma.c:121:19: warning: variable 'mapping' is uninitialized when used here [-Wuninitialized] priv->mapping = mapping; ^~~~~~~ drivers/gpu/drm/exynos/exynos_drm_dma.c:111:16: note: initialize the variable 'mapping' to silence this warning void *mapping; ^ = NULL 1 warning generated. This occurs when CONFIG_EXYNOS_IOMMU is enabled and both CONFIG_ARM_DMA_USE_IOMMU and CONFIG_IOMMU_DMA are disabled, which makes the code look like void *mapping; if (0) mapping = arm_iommu_create_mapping() else if (0) mapping = iommu_get_domain_for_dev() ... priv->mapping = mapping; Add an else branch that initializes mapping to the -ENODEV error pointer so that there is no more warning and the driver does not change during runtime. Reported-by: kernel test robot <[email protected]> Signed-off-by: Nathan Chancellor <[email protected]> Signed-off-by: Inki Dae <[email protected]>
1 parent 8c27cc5 commit c626f38

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

drivers/gpu/drm/exynos/exynos_drm_dma.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,8 @@ int exynos_drm_register_dma(struct drm_device *drm, struct device *dev,
115115
EXYNOS_DEV_ADDR_START, EXYNOS_DEV_ADDR_SIZE);
116116
else if (IS_ENABLED(CONFIG_IOMMU_DMA))
117117
mapping = iommu_get_domain_for_dev(priv->dma_dev);
118+
else
119+
mapping = ERR_PTR(-ENODEV);
118120

119121
if (IS_ERR(mapping))
120122
return PTR_ERR(mapping);

0 commit comments

Comments
 (0)