Patchwork UBUNTU: SAUCE: drm/radeon/hdmi: make sure we have an afmt block assigned

login
register
mail settings
Submitter Paolo Pisati
Date July 23, 2013, 1:35 p.m.
Message ID <1374586545-10693-2-git-send-email-paolo.pisati@canonical.com>
Download mbox | patch
Permalink /patch/261088/
State New
Headers show

Comments

Paolo Pisati - July 23, 2013, 1:35 p.m.
From: Alex Deucher <alexander.deucher@amd.com>

Prevents a segfault if an afmt block is not assigned to the
encoder such as in the LVDS or eDP case.

Fixes:
https://bugs.freedesktop.org/show_bug.cgi?id=66714

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org
(cherry picked from commit c2b4cacfe9816c1fe378c785ce8a678cf0635ec6)

BugLink: https://bugs.launchpad.net/bugs/1195687

Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
---
 drivers/gpu/drm/radeon/evergreen_hdmi.c | 6 ++++++
 drivers/gpu/drm/radeon/r600_hdmi.c      | 6 ++++++
 2 files changed, 12 insertions(+)
Tim Gardner - July 23, 2013, 1:50 p.m.

Patch

diff --git a/drivers/gpu/drm/radeon/evergreen_hdmi.c b/drivers/gpu/drm/radeon/evergreen_hdmi.c
index ed7c8a7..df92fbe 100644
--- a/drivers/gpu/drm/radeon/evergreen_hdmi.c
+++ b/drivers/gpu/drm/radeon/evergreen_hdmi.c
@@ -184,6 +184,9 @@  void evergreen_hdmi_setmode(struct drm_encoder *encoder, struct drm_display_mode
 	uint32_t offset;
 	ssize_t err;
 
+	if (!dig || !dig->afmt)
+		return;
+
 	/* Silent, r600_hdmi_enable will raise WARN for us */
 	if (!dig->afmt->enabled)
 		return;
@@ -287,6 +290,9 @@  void evergreen_hdmi_enable(struct drm_encoder *encoder, bool enable)
 	struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder);
 	struct radeon_encoder_atom_dig *dig = radeon_encoder->enc_priv;
 
+	if (!dig || !dig->afmt)
+		return;
+
 	/* Silent, r600_hdmi_enable will raise WARN for us */
 	if (enable && dig->afmt->enabled)
 		return;
diff --git a/drivers/gpu/drm/radeon/r600_hdmi.c b/drivers/gpu/drm/radeon/r600_hdmi.c
index 456750a..9db0b18 100644
--- a/drivers/gpu/drm/radeon/r600_hdmi.c
+++ b/drivers/gpu/drm/radeon/r600_hdmi.c
@@ -273,6 +273,9 @@  void r600_hdmi_setmode(struct drm_encoder *encoder, struct drm_display_mode *mod
 	uint32_t offset;
 	ssize_t err;
 
+	if (!dig || !dig->afmt)
+		return;
+
 	/* Silent, r600_hdmi_enable will raise WARN for us */
 	if (!dig->afmt->enabled)
 		return;
@@ -455,6 +458,9 @@  void r600_hdmi_enable(struct drm_encoder *encoder, bool enable)
 	struct radeon_encoder_atom_dig *dig = radeon_encoder->enc_priv;
 	u32 hdmi = HDMI0_ERROR_ACK;
 
+	if (!dig || !dig->afmt)
+		return;
+
 	/* Silent, r600_hdmi_enable will raise WARN for us */
 	if (enable && dig->afmt->enabled)
 		return;