]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
drm/msm/adreno: fix probe without iommu
authorLuca Weiss <luca@z3ntu.xyz>
Fri, 11 Sep 2020 16:08:53 +0000 (18:08 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 29 Oct 2020 09:07:37 +0000 (10:07 +0100)
[ Upstream commit 0a48db562c6264da2ae8013491efd6e8dc780520 ]

The function iommu_domain_alloc returns NULL on platforms without IOMMU
such as msm8974. This resulted in PTR_ERR(-ENODEV) being assigned to
gpu->aspace so the correct code path wasn't taken.

Fixes: ccac7ce373c1 ("drm/msm: Refactor address space initialization")
Signed-off-by: Luca Weiss <luca@z3ntu.xyz>
Reviewed-by: Jordan Crouse <jcrouse@codeaurora.org>
Signed-off-by: Rob Clark <robdclark@chromium.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/gpu/drm/msm/adreno/adreno_gpu.c

index a74ccc5b8220d3d9892f21ed4bfe7ab0a6c1dcac..5b5809c0e44b3fc81328eae50bdb08919b7b959e 100644 (file)
@@ -189,10 +189,16 @@ struct msm_gem_address_space *
 adreno_iommu_create_address_space(struct msm_gpu *gpu,
                struct platform_device *pdev)
 {
-       struct iommu_domain *iommu = iommu_domain_alloc(&platform_bus_type);
-       struct msm_mmu *mmu = msm_iommu_new(&pdev->dev, iommu);
+       struct iommu_domain *iommu;
+       struct msm_mmu *mmu;
        struct msm_gem_address_space *aspace;
 
+       iommu = iommu_domain_alloc(&platform_bus_type);
+       if (!iommu)
+               return NULL;
+
+       mmu = msm_iommu_new(&pdev->dev, iommu);
+
        aspace = msm_gem_address_space_create(mmu, "gpu", SZ_16M,
                0xffffffff - SZ_16M);