[PATCH 01/13] drm/msm/dpu: cleanup dpu_kms_hw_init error path
Konrad Dybcio
konrad.dybcio at linaro.org
Fri Jul 7 23:25:41 UTC 2023
On 7.07.2023 22:37, Dmitry Baryshkov wrote:
> It was noticed that dpu_kms_hw_init()'s error path contains several
> labels which point to the same code path. Replace all of them with a
> single label.
>
> Suggested-by: Konrad Dybcio <konrad.dybcio at linaro.org>
it's the first time I'm seeing this code
Konrad
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov at linaro.org>
> ---
> drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 21 +++++++++------------
> 1 file changed, 9 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
> index c11b3ab572ab..e7ac02e92f42 100644
> --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
> +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
> @@ -1037,7 +1037,7 @@ static int dpu_kms_hw_init(struct msm_kms *kms)
> if (!dpu_kms->catalog) {
> DPU_ERROR("device config not known!\n");
> rc = -EINVAL;
> - goto power_error;
> + goto err_pm_put;
> }
>
> /*
> @@ -1047,13 +1047,13 @@ static int dpu_kms_hw_init(struct msm_kms *kms)
> rc = _dpu_kms_mmu_init(dpu_kms);
> if (rc) {
> DPU_ERROR("dpu_kms_mmu_init failed: %d\n", rc);
> - goto power_error;
> + goto err_pm_put;
> }
>
> rc = dpu_rm_init(&dpu_kms->rm, dpu_kms->catalog, dpu_kms->mmio);
> if (rc) {
> DPU_ERROR("rm init failed: %d\n", rc);
> - goto power_error;
> + goto err_pm_put;
> }
>
> dpu_kms->rm_init = true;
> @@ -1065,7 +1065,7 @@ static int dpu_kms_hw_init(struct msm_kms *kms)
> rc = PTR_ERR(dpu_kms->hw_mdp);
> DPU_ERROR("failed to get hw_mdp: %d\n", rc);
> dpu_kms->hw_mdp = NULL;
> - goto power_error;
> + goto err_pm_put;
> }
>
> for (i = 0; i < dpu_kms->catalog->vbif_count; i++) {
> @@ -1076,7 +1076,7 @@ static int dpu_kms_hw_init(struct msm_kms *kms)
> if (IS_ERR(hw)) {
> rc = PTR_ERR(hw);
> DPU_ERROR("failed to init vbif %d: %d\n", vbif->id, rc);
> - goto power_error;
> + goto err_pm_put;
> }
>
> dpu_kms->hw_vbif[vbif->id] = hw;
> @@ -1092,7 +1092,7 @@ static int dpu_kms_hw_init(struct msm_kms *kms)
> rc = dpu_core_perf_init(&dpu_kms->perf, dpu_kms->catalog->perf, max_core_clk_rate);
> if (rc) {
> DPU_ERROR("failed to init perf %d\n", rc);
> - goto perf_err;
> + goto err_pm_put;
> }
>
> dpu_kms->hw_intr = dpu_hw_intr_init(dpu_kms->mmio, dpu_kms->catalog);
> @@ -1100,7 +1100,7 @@ static int dpu_kms_hw_init(struct msm_kms *kms)
> rc = PTR_ERR(dpu_kms->hw_intr);
> DPU_ERROR("hw_intr init failed: %d\n", rc);
> dpu_kms->hw_intr = NULL;
> - goto hw_intr_init_err;
> + goto err_pm_put;
> }
>
> dev->mode_config.min_width = 0;
> @@ -1125,7 +1125,7 @@ static int dpu_kms_hw_init(struct msm_kms *kms)
> rc = _dpu_kms_drm_obj_init(dpu_kms);
> if (rc) {
> DPU_ERROR("modeset init failed: %d\n", rc);
> - goto drm_obj_init_err;
> + goto err_pm_put;
> }
>
> dpu_vbif_init_memtypes(dpu_kms);
> @@ -1134,10 +1134,7 @@ static int dpu_kms_hw_init(struct msm_kms *kms)
>
> return 0;
>
> -drm_obj_init_err:
> -hw_intr_init_err:
> -perf_err:
> -power_error:
> +err_pm_put:
> pm_runtime_put_sync(&dpu_kms->pdev->dev);
> error:
> _dpu_kms_hw_destroy(dpu_kms);
More information about the dri-devel
mailing list