summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/msm/msm_iommu.c
diff options
context:
space:
mode:
authorLuca Weiss <luca@z3ntu.xyz>2023-05-08 22:26:45 +0200
committerRob Clark <robdclark@chromium.org>2023-05-11 07:40:30 -0700
commitdb40d2928d245f3a6cba9a6a2547ec955b00f0fc (patch)
tree32d69d022ef5667f0059c366222579e162fbce01 /drivers/gpu/drm/msm/msm_iommu.c
parentca29699a57ecee6084a4056f5bfd6f11dd359a71 (diff)
downloadlinux-stable-db40d2928d245f3a6cba9a6a2547ec955b00f0fc.tar.gz
linux-stable-db40d2928d245f3a6cba9a6a2547ec955b00f0fc.tar.bz2
linux-stable-db40d2928d245f3a6cba9a6a2547ec955b00f0fc.zip
drm/msm/iommu: Fix null pointer dereference in no-IOMMU case
In the case that no IOMMU is available, msm_iommu_new can return NULL which should be handled. Without we will get a NULL pointer dereference in the next statement when we try to use the mmu variable. Fixes: 8cceb773f565 ("drm/msm/adreno: stall translation on fault for all GPU families") Signed-off-by: Luca Weiss <luca@z3ntu.xyz> Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> Patchwork: https://patchwork.freedesktop.org/patch/535915/ Link: https://lore.kernel.org/r/20230508-6-4-drm-msm-iommu-fixup-v1-1-a7a21ec94f5b@z3ntu.xyz Signed-off-by: Rob Clark <robdclark@chromium.org>
Diffstat (limited to 'drivers/gpu/drm/msm/msm_iommu.c')
-rw-r--r--drivers/gpu/drm/msm/msm_iommu.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/gpu/drm/msm/msm_iommu.c b/drivers/gpu/drm/msm/msm_iommu.c
index 418e1e06cdde..5080319ae4cf 100644
--- a/drivers/gpu/drm/msm/msm_iommu.c
+++ b/drivers/gpu/drm/msm/msm_iommu.c
@@ -410,7 +410,7 @@ struct msm_mmu *msm_iommu_gpu_new(struct device *dev, struct msm_gpu *gpu, unsig
struct msm_mmu *mmu;
mmu = msm_iommu_new(dev, quirks);
- if (IS_ERR(mmu))
+ if (IS_ERR_OR_NULL(mmu))
return mmu;
iommu = to_msm_iommu(mmu);