Skip to content

Commit 8d1b780

Browse files
committed
drm/exynos: fix a wrong error checking
Fix a wrong error checking in exynos_drm_dma.c module. In the exynos_drm_register_dma function, both arm_iommu_create_mapping() and iommu_get_domain_for_dev() functions are expected to return NULL as an error. However, the error checking is performed using the statement if(IS_ERR(mapping)), which doesn't provide a suitable error value. So check if 'mapping' is NULL, and if it is, return -ENODEV. This issue[1] was reported by Dan. Changelog v1: - fix build warning. [1] https://lore.kernel.org/all/[email protected]/ Reported-by : Dan Carpenter <[email protected]> Signed-off-by: Inki Dae <[email protected]>
1 parent 73bf1c9 commit 8d1b780

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

drivers/gpu/drm/exynos/exynos_drm_dma.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -107,18 +107,16 @@ int exynos_drm_register_dma(struct drm_device *drm, struct device *dev,
107107
return 0;
108108

109109
if (!priv->mapping) {
110-
void *mapping;
110+
void *mapping = NULL;
111111

112112
if (IS_ENABLED(CONFIG_ARM_DMA_USE_IOMMU))
113113
mapping = arm_iommu_create_mapping(&platform_bus_type,
114114
EXYNOS_DEV_ADDR_START, EXYNOS_DEV_ADDR_SIZE);
115115
else if (IS_ENABLED(CONFIG_IOMMU_DMA))
116116
mapping = iommu_get_domain_for_dev(priv->dma_dev);
117-
else
118-
mapping = ERR_PTR(-ENODEV);
119117

120-
if (IS_ERR(mapping))
121-
return PTR_ERR(mapping);
118+
if (!mapping)
119+
return -ENODEV;
122120
priv->mapping = mapping;
123121
}
124122

0 commit comments

Comments
 (0)