drm/msm/dpu: release resources on modeset failure
authorJeykumar Sankaran <jsanka@codeaurora.org>
Thu, 14 Feb 2019 01:19:12 +0000 (17:19 -0800)
committerRob Clark <robdclark@chromium.org>
Thu, 18 Apr 2019 17:04:10 +0000 (10:04 -0700)
release resources allocated in mode_set if any of
the hw check fails. Most of these checks are not
necessary and they will be removed in the follow up
patches with state based resource allocations.

Signed-off-by: Jeykumar Sankaran <jsanka@codeaurora.org>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Link: https://patchwork.freedesktop.org/patch/msgid/1550107156-17625-4-git-send-email-jsanka@codeaurora.org
Signed-off-by: Rob Clark <robdclark@chromium.org>
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c

index c51bc0fdd9c3b3ac4f8b256e1a46bf2f3a5100b3..7d7779d7014578cb67f908321d64c8fc4ab2978a 100644 (file)
@@ -1026,13 +1026,13 @@ static void dpu_encoder_virt_mode_set(struct drm_encoder *drm_enc,
                        if (!dpu_enc->hw_pp[i]) {
                                DPU_ERROR_ENC(dpu_enc, "no pp block assigned"
                                             "at idx: %d\n", i);
-                               return;
+                               goto error;
                        }
 
                        if (!hw_ctl[i]) {
                                DPU_ERROR_ENC(dpu_enc, "no ctl block assigned"
                                             "at idx: %d\n", i);
-                               return;
+                               goto error;
                        }
 
                        phys->hw_pp = dpu_enc->hw_pp[i];
@@ -1045,6 +1045,9 @@ static void dpu_encoder_virt_mode_set(struct drm_encoder *drm_enc,
        }
 
        dpu_enc->mode_set_complete = true;
+
+error:
+       dpu_rm_release(&dpu_kms->rm, drm_enc);
 }
 
 static void _dpu_encoder_virt_enable_helper(struct drm_encoder *drm_enc)