Skip to contentSkip to conversation

drm/msm/a6xx: handle runtime resume failures

PATCH New Jiale Yao 1 participant 1 message Oct 3

Subsystems (4)
lore
Share & tools
lore

Jiale Yao

author
#0 lore raw

PATCH 1/1 drm/msm/a6xx: handle runtime resume failures

a6xx_pm_resume() ignores failures while resuming the GMU device and GX power domain, then continues enabling clocks and initializing hardware. The common error path also drops both runtime PM references even when either acquisition failed.

Check each resume operation and unwind only the references acquired before the failure.

Fixes 5a903a44a984 ("drm/msm/a6xx: Introduce GMU wrapper support")
---
 drivers/gpu/drm/msm/adreno/a6xx_gpu.c | 23 +++++++++++++++--------
 1 file changed, 15 insertions(+), 8 deletions(-)
drivers/gpu/drm/msm/adreno/a6xx_gpu.c +15 -8
index 081e79ea4652..aa785f197aa0 100644
@@ -2188,8 +2188,13 @@ static int a6xx_pm_resume(struct msm_gpu *gpu)
 	/* Set the core clock and bus bw, having VDD scaling in mind */
 	dev_pm_opp_set_opp(&gpu->pdev->dev, opp);
 
-	pm_runtime_resume_and_get(gmu->dev);
-	pm_runtime_resume_and_get(gmu->gxpd);
+	ret = pm_runtime_resume_and_get(gmu->dev);
+	if (ret < 0)
+		goto err_clear_opp;
+
+	ret = pm_runtime_resume_and_get(gmu->gxpd);
+	if (ret < 0)
+		goto err_put_gmu;
 
 	ret = clk_bulk_prepare_enable(gpu->nr_clocks, gpu->grp_clks);
 	if (ret)
@@ -2204,14 +2209,16 @@ static int a6xx_pm_resume(struct msm_gpu *gpu)
 	if (adreno_is_a619_holi(adreno_gpu))
 		a6xx_sptprac_enable(gmu);
 
-	/* If anything goes south, tear the GPU down piece by piece.. */
-	if (ret) {
+	goto out_unlock;
+
 err_bulk_clk:
-		pm_runtime_put(gmu->gxpd);
-		pm_runtime_put(gmu->dev);
-		dev_pm_opp_set_opp(&gpu->pdev->dev, NULL);
-	}
+	pm_runtime_put(gmu->gxpd);
+err_put_gmu:
+	pm_runtime_put(gmu->dev);
+err_clear_opp:
+	dev_pm_opp_set_opp(&gpu->pdev->dev, NULL);
 err_set_opp:
+out_unlock:
 	mutex_unlock(&a6xx_gpu->gmu.lock);
 
 	if (!ret) {
Signature · 1 line
2.34.1