Merge "drm/msm: Free all allocated resources in case hardware init fails" into msm-4.4

This commit is contained in:
Linux Build Service Account 2017-08-20 01:17:33 -07:00 committed by Gerrit - the friendly Code Review server
commit a254db548d
2 changed files with 21 additions and 0 deletions

View file

@ -173,6 +173,9 @@ struct msm_gpu *adreno_load_gpu(struct drm_device *dev)
ret = gpu->funcs->hw_init(gpu);
if (ret) {
dev_err(dev->dev, "gpu hw init failed: %d\n", ret);
mutex_lock(&dev->struct_mutex);
gpu->funcs->pm_suspend(gpu);
mutex_unlock(&dev->struct_mutex);
gpu->funcs->destroy(gpu);
gpu = NULL;
} else {

View file

@ -1028,4 +1028,22 @@ void msm_gpu_cleanup(struct msm_gpu *gpu)
msm_gpu_destroy_address_space(gpu->aspace);
msm_gpu_destroy_address_space(gpu->secure_aspace);
if (gpu->gpu_reg)
devm_regulator_put(gpu->gpu_reg);
if (gpu->gpu_cx)
devm_regulator_put(gpu->gpu_cx);
if (gpu->ebi1_clk)
devm_clk_put(&pdev->dev, gpu->ebi1_clk);
for (i = gpu->nr_clocks - 1; i >= 0; i--)
if (gpu->grp_clks[i])
devm_clk_put(&pdev->dev, gpu->grp_clks[i]);
devm_kfree(&pdev->dev, gpu->grp_clks);
if (gpu->mmio)
devm_iounmap(&pdev->dev, gpu->mmio);
}