Skip to content

Commit b998684

Browse files
konradybciorobclark
authored andcommitted
drm/msm/a6xx: Fix up QMP handling
The commit referenced in the Fixes tag had a couple problems (as pointed out by Dan): - qmp_put was never called, resulting in refcnt leaks - failling to acquire the QMP mailbox on A7xx would not undo the probe function properly - the qmp_put call present in the code was unreachable Fix all of these issues. Reported-by: Dan Carpenter <dan.carpenter@linaro.org> Fixes: 88a0997 ("drm/msm/a6xx: Send ACD state to QMP at GMU resume") Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org> Patchwork: https://patchwork.freedesktop.org/patch/562761/ Signed-off-by: Rob Clark <robdclark@chromium.org>
1 parent 5e05be7 commit b998684

1 file changed

Lines changed: 12 additions & 6 deletions

File tree

drivers/gpu/drm/msm/adreno/a6xx_gmu.c

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1558,6 +1558,9 @@ void a6xx_gmu_remove(struct a6xx_gpu *a6xx_gpu)
15581558
dev_pm_domain_detach(gmu->gxpd, false);
15591559
}
15601560

1561+
if (!IS_ERR_OR_NULL(gmu->qmp))
1562+
qmp_put(gmu->qmp);
1563+
15611564
iounmap(gmu->mmio);
15621565
if (platform_get_resource_byname(pdev, IORESOURCE_MEM, "rscc"))
15631566
iounmap(gmu->rscc);
@@ -1654,6 +1657,7 @@ int a6xx_gmu_init(struct a6xx_gpu *a6xx_gpu, struct device_node *node)
16541657
struct adreno_gpu *adreno_gpu = &a6xx_gpu->base;
16551658
struct a6xx_gmu *gmu = &a6xx_gpu->gmu;
16561659
struct platform_device *pdev = of_find_device_by_node(node);
1660+
struct device_link *link;
16571661
int ret;
16581662

16591663
if (!pdev)
@@ -1777,15 +1781,17 @@ int a6xx_gmu_init(struct a6xx_gpu *a6xx_gpu, struct device_node *node)
17771781
goto err_mmio;
17781782
}
17791783

1780-
if (!device_link_add(gmu->dev, gmu->cxpd,
1781-
DL_FLAG_PM_RUNTIME)) {
1784+
link = device_link_add(gmu->dev, gmu->cxpd, DL_FLAG_PM_RUNTIME);
1785+
if (!link) {
17821786
ret = -ENODEV;
17831787
goto detach_cxpd;
17841788
}
17851789

17861790
gmu->qmp = qmp_get(gmu->dev);
1787-
if (IS_ERR(gmu->qmp) && adreno_is_a7xx(adreno_gpu))
1788-
return PTR_ERR(gmu->qmp);
1791+
if (IS_ERR(gmu->qmp) && adreno_is_a7xx(adreno_gpu)) {
1792+
ret = PTR_ERR(gmu->qmp);
1793+
goto remove_device_link;
1794+
}
17891795

17901796
init_completion(&gmu->pd_gate);
17911797
complete_all(&gmu->pd_gate);
@@ -1810,8 +1816,8 @@ int a6xx_gmu_init(struct a6xx_gpu *a6xx_gpu, struct device_node *node)
18101816

18111817
return 0;
18121818

1813-
if (!IS_ERR_OR_NULL(gmu->qmp))
1814-
qmp_put(gmu->qmp);
1819+
remove_device_link:
1820+
device_link_del(link);
18151821

18161822
detach_cxpd:
18171823
dev_pm_domain_detach(gmu->cxpd, false);

0 commit comments

Comments
 (0)