Unverified Commit 227295df authored by Danilo Krummrich's avatar Danilo Krummrich Committed by Maxime Ripard
Browse files

drm/vc4: hdmi: unlock mutex when device is unplugged



In vc4_hdmi_encoder_{pre,post}_crtc_enable() commit cd00ed51
("drm/vc4: hdmi: Protect device resources after removal") missed to
unlock the mutex before returning due to drm_dev_enter() indicating the
device being unplugged.

Fixes: cd00ed51 ("drm/vc4: hdmi: Protect device resources after removal")
Signed-off-by: default avatarDanilo Krummrich <dakr@redhat.com>
Signed-off-by: default avatarMaxime Ripard <maxime@cerno.tech>
Link: https://lore.kernel.org/r/20220824161327.330627-2-dakr@redhat.com
parent 4d07b0bc
Loading
Loading
Loading
Loading
+5 −2
Original line number Original line Diff line number Diff line
@@ -1425,7 +1425,7 @@ static void vc4_hdmi_encoder_pre_crtc_enable(struct drm_encoder *encoder,
	mutex_lock(&vc4_hdmi->mutex);
	mutex_lock(&vc4_hdmi->mutex);


	if (!drm_dev_enter(drm, &idx))
	if (!drm_dev_enter(drm, &idx))
		return;
		goto out;


	if (vc4_hdmi->variant->csc_setup)
	if (vc4_hdmi->variant->csc_setup)
		vc4_hdmi->variant->csc_setup(vc4_hdmi, conn_state, mode);
		vc4_hdmi->variant->csc_setup(vc4_hdmi, conn_state, mode);
@@ -1436,6 +1436,7 @@ static void vc4_hdmi_encoder_pre_crtc_enable(struct drm_encoder *encoder,


	drm_dev_exit(idx);
	drm_dev_exit(idx);


out:
	mutex_unlock(&vc4_hdmi->mutex);
	mutex_unlock(&vc4_hdmi->mutex);
}
}


@@ -1455,7 +1456,7 @@ static void vc4_hdmi_encoder_post_crtc_enable(struct drm_encoder *encoder,
	mutex_lock(&vc4_hdmi->mutex);
	mutex_lock(&vc4_hdmi->mutex);


	if (!drm_dev_enter(drm, &idx))
	if (!drm_dev_enter(drm, &idx))
		return;
		goto out;


	spin_lock_irqsave(&vc4_hdmi->hw_lock, flags);
	spin_lock_irqsave(&vc4_hdmi->hw_lock, flags);


@@ -1516,6 +1517,8 @@ static void vc4_hdmi_encoder_post_crtc_enable(struct drm_encoder *encoder,
	vc4_hdmi_enable_scrambling(encoder);
	vc4_hdmi_enable_scrambling(encoder);


	drm_dev_exit(idx);
	drm_dev_exit(idx);

out:
	mutex_unlock(&vc4_hdmi->mutex);
	mutex_unlock(&vc4_hdmi->mutex);
}
}