drm/exynos: Always initialize mapping in exynos_drm_register_dma()
Subsystems (3)
PATCH 1/1 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;
^
= NULL1 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]>
--- drivers/gpu/drm/exynos/exynos_drm_dma.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/gpu/drm/exynos/exynos_drm_dma.c +2 -0
@@ -115,6 +115,8 @@ int exynos_drm_register_dma(struct drm_device *drm, struct device *dev, EXYNOS_DEV_ADDR_START, EXYNOS_DEV_ADDR_SIZE); else if (IS_ENABLED(CONFIG_IOMMU_DMA)) mapping =iommu_get_domain_for_dev (priv->dma_dev); + else + mapping =ERR_PTR (-ENODEV );if (IS_ERR (mapping))return PTR_ERR (mapping);
base-commit: 7d549995d4e0d99b68e8a7793a0d23da6fc40fe8
Signature · 1 line
2.32.0.264.g75ae10bc75