Message ID | 20230730011920.354575-2-dmitry.baryshkov@linaro.org |
---|---|
State | New |
Headers | show |
Series | drm/msm/dpu: use managed memory allocations | expand |
On 7/29/2023 6:19 PM, 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@linaro.org> > Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> Reviewed-by: Jessica Zhang <quic_jesszhan@quicinc.com> > --- > 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 31782a6d821f..77a79bc42492 100644 > --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c > +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c > @@ -1077,7 +1077,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; > } > > /* > @@ -1087,13 +1087,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; > @@ -1105,7 +1105,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++) { > @@ -1116,7 +1116,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; > @@ -1132,7 +1132,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); > @@ -1140,7 +1140,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; > @@ -1165,7 +1165,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); > @@ -1174,10 +1174,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); > -- > 2.39.2 >
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c index 31782a6d821f..77a79bc42492 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c @@ -1077,7 +1077,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; } /* @@ -1087,13 +1087,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; @@ -1105,7 +1105,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++) { @@ -1116,7 +1116,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; @@ -1132,7 +1132,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); @@ -1140,7 +1140,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; @@ -1165,7 +1165,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); @@ -1174,10 +1174,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);
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@linaro.org> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> --- drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-)