[bug report] drm/exynos/iommu: merge IOMMU and DMA code

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello Andrzej Hajda,

The patch 67fbf3a3ef84: "drm/exynos/iommu: merge IOMMU and DMA code"
from Oct 12, 2018 (linux-next), leads to the following Smatch static
checker warning:

	drivers/gpu/drm/exynos/exynos_drm_dma.c:120 exynos_drm_register_dma()
	warn: 'mapping' isn't an ERR_PTR

drivers/gpu/drm/exynos/exynos_drm_dma.c
    95 int exynos_drm_register_dma(struct drm_device *drm, struct device *dev,
    96                             void **dma_priv)
    97 {
    98         struct exynos_drm_private *priv = drm->dev_private;
    99 
    100         if (!priv->dma_dev) {
    101                 priv->dma_dev = dev;
    102                 DRM_INFO("Exynos DRM: using %s device for DMA mapping operations\n",
    103                          dev_name(dev));
    104         }
    105 
    106         if (!IS_ENABLED(CONFIG_EXYNOS_IOMMU))
    107                 return 0;
    108 
    109         if (!priv->mapping) {
    110                 void *mapping;
    111 
    112                 if (IS_ENABLED(CONFIG_ARM_DMA_USE_IOMMU))
    113                         mapping = arm_iommu_create_mapping(&platform_bus_type,
    114                                 EXYNOS_DEV_ADDR_START, EXYNOS_DEV_ADDR_SIZE);
    115                 else if (IS_ENABLED(CONFIG_IOMMU_DMA))
    116                         mapping = iommu_get_domain_for_dev(priv->dma_dev);

arm_iommu_create_mapping() and iommu_get_domain_for_dev() seem to return
NULL on error.

    117                 else
    118                         mapping = ERR_PTR(-ENODEV);
    119 
--> 120                 if (IS_ERR(mapping))
    121                         return PTR_ERR(mapping);

Smatch uses the pre-compiled code so it says that mapping is always NULL
on this config...

    122                 priv->mapping = mapping;
    123         }
    124 
    125         return drm_iommu_attach_device(drm, dev, dma_priv);
    126 }

regards,
dan carpenter



[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux