Commit 3d91e50f authored by Dan Carpenter's avatar Dan Carpenter Committed by Rob Clark

drm/msm: Fix potential Oops in a6xx_gmu_rpmh_init()

There are two problems here:
1) The "seqptr" is used uninitalized when we free it at the end.
2) The a6xx_gmu_get_mmio() function returns error pointers.  It never
   returns true.

Fixes: 64245fc5 ("drm/msm/a6xx: use AOP-initialized PDC for a650")
Fixes: f8fc924e ("drm/msm/a6xx: Fix PDC register overlap")
Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: default avatarDmitry Baryshkov <dmitry.baryshkov@linaro.org>
Link: https://lore.kernel.org/r/20211004134530.GB11689@kiliSigned-off-by: default avatarDmitry Baryshkov <dmitry.baryshkov@linaro.org>
Signed-off-by: default avatarRob Clark <robdclark@chromium.org>
parent bf94ec09
...@@ -516,11 +516,11 @@ static void a6xx_gmu_rpmh_init(struct a6xx_gmu *gmu) ...@@ -516,11 +516,11 @@ static void a6xx_gmu_rpmh_init(struct a6xx_gmu *gmu)
struct adreno_gpu *adreno_gpu = &a6xx_gpu->base; struct adreno_gpu *adreno_gpu = &a6xx_gpu->base;
struct platform_device *pdev = to_platform_device(gmu->dev); struct platform_device *pdev = to_platform_device(gmu->dev);
void __iomem *pdcptr = a6xx_gmu_get_mmio(pdev, "gmu_pdc"); void __iomem *pdcptr = a6xx_gmu_get_mmio(pdev, "gmu_pdc");
void __iomem *seqptr; void __iomem *seqptr = NULL;
uint32_t pdc_address_offset; uint32_t pdc_address_offset;
bool pdc_in_aop = false; bool pdc_in_aop = false;
if (!pdcptr) if (IS_ERR(pdcptr))
goto err; goto err;
if (adreno_is_a650(adreno_gpu) || adreno_is_a660_family(adreno_gpu)) if (adreno_is_a650(adreno_gpu) || adreno_is_a660_family(adreno_gpu))
...@@ -532,7 +532,7 @@ static void a6xx_gmu_rpmh_init(struct a6xx_gmu *gmu) ...@@ -532,7 +532,7 @@ static void a6xx_gmu_rpmh_init(struct a6xx_gmu *gmu)
if (!pdc_in_aop) { if (!pdc_in_aop) {
seqptr = a6xx_gmu_get_mmio(pdev, "gmu_pdc_seq"); seqptr = a6xx_gmu_get_mmio(pdev, "gmu_pdc_seq");
if (!seqptr) if (IS_ERR(seqptr))
goto err; goto err;
} }
......
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