Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5e921b19 authored by Stephane Viau's avatar Stephane Viau Committed by Rob Clark
Browse files

drm/msm: Fix IOMMU clean up path in case msm_iommu_new() fails



msm_iommu_new() can fail and this change makes sure that we
detect the failure and free the allocated domain before going
any further.

Signed-off-by: default avatarStephane Viau <sviau@codeaurora.org>
Signed-off-by: default avatarRob Clark <robdclark@gmail.com>
parent 60fb49ca
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -586,6 +586,7 @@ struct msm_kms *mdp5_kms_init(struct drm_device *dev)
		if (IS_ERR(mmu)) {
			ret = PTR_ERR(mmu);
			dev_err(dev->dev, "failed to init iommu: %d\n", ret);
			iommu_domain_free(config->platform.iommu);
			goto fail;
		}

+8 −0
Original line number Diff line number Diff line
@@ -651,6 +651,14 @@ int msm_gpu_init(struct drm_device *drm, struct platform_device *pdev,
	if (iommu) {
		dev_info(drm->dev, "%s: using IOMMU\n", name);
		gpu->mmu = msm_iommu_new(&pdev->dev, iommu);
		if (IS_ERR(gpu->mmu)) {
			ret = PTR_ERR(gpu->mmu);
			dev_err(drm->dev, "failed to init iommu: %d\n", ret);
			gpu->mmu = NULL;
			iommu_domain_free(iommu);
			goto fail;
		}

	} else {
		dev_info(drm->dev, "%s: no IOMMU, fallback to VRAM carveout!\n", name);
	}