disp: msm: sde: cancel delayed_off_work before reinitialization

Canceling delayed_off_work in encoder pre_modeset might not be
executed in all cases, but the following encoder enable might
initialize the work.

This will lead to list corruption as delayed_off work list node
is reinitialized before removing from linked list.
Move canceling delayed_off_work to start of encoder mode_set to
ensure work is canceled before reinitialization.

Change-Id: I38687604f2eedced308ea02019c162022725534e
Signed-off-by: Lei Chen <quic_chenlei@quicinc.com>
Signed-off-by: Jayaprakash Madisetty <quic_jmadiset@quicinc.com>
This commit is contained in:
Lei Chen 2021-10-22 12:21:19 +05:30 • committed by Jayaprakash Madisetty
commit 8d57f083f2

View file

@ -1842,9 +1842,6 @@ static int _sde_encoder_rc_pre_modeset(struct drm_encoder *drm_enc,
{
int ret = 0;
/* cancel delayed off work, if any */
_sde_encoder_rc_cancel_delayed(sde_enc, sw_event);
mutex_lock(&sde_enc->rc_lock);
if (sde_enc->rc_state == SDE_ENC_RC_STATE_OFF) {
@ -2371,6 +2368,9 @@ static void sde_encoder_virt_mode_set(struct drm_encoder *drm_enc,
sde_connector_state_get_mode_info(conn->state, &sde_enc->mode_info);
sde_encoder_dce_set_bpp(sde_enc->mode_info, sde_enc->crtc);
/* cancel delayed off work, if any */
kthread_cancel_delayed_work_sync(&sde_enc->delayed_off_work);
/* release resources before seamless mode change */
ret = sde_encoder_virt_modeset_rc(drm_enc, adj_mode, true);
if (ret)