Commit de85d2b3 authored by Rob Clark's avatar Rob Clark

drm/msm: fix potential null ptr issue in non-iommu case

Fixes: 9cb07b099fb ("drm/msm: support multiple address spaces")
Reported-by: default avatarRiku Voipio <riku.voipio@linaro.org>
Signed-off-by: default avatarRob Clark <robdclark@gmail.com>
parent c57a94ff
...@@ -345,7 +345,6 @@ int adreno_gpu_init(struct drm_device *drm, struct platform_device *pdev, ...@@ -345,7 +345,6 @@ int adreno_gpu_init(struct drm_device *drm, struct platform_device *pdev,
{ {
struct adreno_platform_config *config = pdev->dev.platform_data; struct adreno_platform_config *config = pdev->dev.platform_data;
struct msm_gpu *gpu = &adreno_gpu->base; struct msm_gpu *gpu = &adreno_gpu->base;
struct msm_mmu *mmu;
int ret; int ret;
adreno_gpu->funcs = funcs; adreno_gpu->funcs = funcs;
...@@ -385,8 +384,8 @@ int adreno_gpu_init(struct drm_device *drm, struct platform_device *pdev, ...@@ -385,8 +384,8 @@ int adreno_gpu_init(struct drm_device *drm, struct platform_device *pdev,
return ret; return ret;
} }
mmu = gpu->aspace->mmu; if (gpu->aspace && gpu->aspace->mmu) {
if (mmu) { struct msm_mmu *mmu = gpu->aspace->mmu;
ret = mmu->funcs->attach(mmu, iommu_ports, ret = mmu->funcs->attach(mmu, iommu_ports,
ARRAY_SIZE(iommu_ports)); ARRAY_SIZE(iommu_ports));
if (ret) if (ret)
......
...@@ -294,6 +294,8 @@ put_iova(struct drm_gem_object *obj) ...@@ -294,6 +294,8 @@ put_iova(struct drm_gem_object *obj)
WARN_ON(!mutex_is_locked(&dev->struct_mutex)); WARN_ON(!mutex_is_locked(&dev->struct_mutex));
for (id = 0; id < ARRAY_SIZE(msm_obj->domain); id++) { for (id = 0; id < ARRAY_SIZE(msm_obj->domain); id++) {
if (!priv->aspace[id])
continue;
msm_gem_unmap_vma(priv->aspace[id], msm_gem_unmap_vma(priv->aspace[id],
&msm_obj->domain[id], msm_obj->sgt); &msm_obj->domain[id], msm_obj->sgt);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment