summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>2014-11-27 14:49:07 +0200
committerSimon Horman <horms+renesas@verge.net.au>2014-12-11 10:37:28 +0900
commit2fca6ef012125b6cfe2407e26928dd40fba592f8 (patch)
treea4acc967bc6b19571249167be792d1ff844fa3bb
parent9f1eada709d73d15b9ab508add575381a185c1a2 (diff)
downloadrenesas_kernel-2fca6ef012125b6cfe2407e26928dd40fba592f8.tar.gz
renesas_kernel-2fca6ef012125b6cfe2407e26928dd40fba592f8.tar.bz2
renesas_kernel-2fca6ef012125b6cfe2407e26928dd40fba592f8.zip
drm: rcar-du: Fix NULL encoder pointer dereference
The DRM connector's encoder pointer is managed internally by the DRM core and set to NULL when the DRM connector is disconnected from the CRTC it was attached to. This results in a NULL pointer dereference in the HDMI connector functions when trying to call the associated slave encoder's operations. Fix this by retrieving the slave encoder pointer from the R-Car connector structure instead of the DRM connector structure. Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> Signed-off-by: Dave Airlie <airlied@redhat.com> (cherry picked from commit 4fcd01d0f34645710ac92d5523e26019428b0806) Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
-rw-r--r--drivers/gpu/drm/rcar-du/rcar_du_hdmicon.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/drivers/gpu/drm/rcar-du/rcar_du_hdmicon.c b/drivers/gpu/drm/rcar-du/rcar_du_hdmicon.c
index 8abaaf258f4..4d7d4dd46d2 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_hdmicon.c
+++ b/drivers/gpu/drm/rcar-du/rcar_du_hdmicon.c
@@ -25,7 +25,8 @@
static int rcar_du_hdmi_connector_get_modes(struct drm_connector *connector)
{
- struct drm_encoder *encoder = connector->encoder;
+ struct rcar_du_connector *con = to_rcar_connector(connector);
+ struct drm_encoder *encoder = rcar_encoder_to_drm_encoder(con->encoder);
struct drm_encoder_slave_funcs *sfuncs = to_slave_funcs(encoder);
if (sfuncs->get_modes == NULL)
@@ -37,7 +38,8 @@ static int rcar_du_hdmi_connector_get_modes(struct drm_connector *connector)
static int rcar_du_hdmi_connector_mode_valid(struct drm_connector *connector,
struct drm_display_mode *mode)
{
- struct drm_encoder *encoder = connector->encoder;
+ struct rcar_du_connector *con = to_rcar_connector(connector);
+ struct drm_encoder *encoder = rcar_encoder_to_drm_encoder(con->encoder);
struct drm_encoder_slave_funcs *sfuncs = to_slave_funcs(encoder);
if (sfuncs->mode_valid == NULL)
@@ -61,7 +63,8 @@ static void rcar_du_hdmi_connector_destroy(struct drm_connector *connector)
static enum drm_connector_status
rcar_du_hdmi_connector_detect(struct drm_connector *connector, bool force)
{
- struct drm_encoder *encoder = connector->encoder;
+ struct rcar_du_connector *con = to_rcar_connector(connector);
+ struct drm_encoder *encoder = rcar_encoder_to_drm_encoder(con->encoder);
struct drm_encoder_slave_funcs *sfuncs = to_slave_funcs(encoder);
if (sfuncs->detect == NULL)