aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2018-11-10 13:19:52 -0500
committerDave Airlie <airlied@redhat.com>2018-11-10 13:20:01 -0500
commitd10cf6da31128f4678058e1ed77bcb8922d5e4b0 (patch)
tree285497fc4fd1fe52eff8f073f8dd60dbe4adf01c
parent7d588f90fb32aacdebd30481e5a38974ac68b689 (diff)
parenta8939766c75c06b5a0ab691ecbba9347e4e520cf (diff)
Merge tag 'drm-misc-fixes-2018-11-07' of git://anongit.freedesktop.org/drm/drm-misc into drm-fixes
- sun4i: tcon->panel NULL deref protections (Giulio) Cc: Giulio Benetti <giulio.benetti@micronovasrl.com> Signed-off-by: Dave Airlie <airlied@redhat.com> From: Sean Paul <sean@poorly.run> Link: https://patchwork.freedesktop.org/patch/msgid/20181107205051.GA27823@art_vandelay
-rw-r--r--drivers/gpu/drm/sun4i/sun4i_lvds.c4
-rw-r--r--drivers/gpu/drm/sun4i/sun4i_rgb.c4
-rw-r--r--drivers/gpu/drm/sun4i/sun4i_tcon.c5
3 files changed, 7 insertions, 6 deletions
diff --git a/drivers/gpu/drm/sun4i/sun4i_lvds.c b/drivers/gpu/drm/sun4i/sun4i_lvds.c
index af7dcb6da351..e7eb0d1e17be 100644
--- a/drivers/gpu/drm/sun4i/sun4i_lvds.c
+++ b/drivers/gpu/drm/sun4i/sun4i_lvds.c
@@ -75,7 +75,7 @@ static void sun4i_lvds_encoder_enable(struct drm_encoder *encoder)
75 75
76 DRM_DEBUG_DRIVER("Enabling LVDS output\n"); 76 DRM_DEBUG_DRIVER("Enabling LVDS output\n");
77 77
78 if (!IS_ERR(tcon->panel)) { 78 if (tcon->panel) {
79 drm_panel_prepare(tcon->panel); 79 drm_panel_prepare(tcon->panel);
80 drm_panel_enable(tcon->panel); 80 drm_panel_enable(tcon->panel);
81 } 81 }
@@ -88,7 +88,7 @@ static void sun4i_lvds_encoder_disable(struct drm_encoder *encoder)
88 88
89 DRM_DEBUG_DRIVER("Disabling LVDS output\n"); 89 DRM_DEBUG_DRIVER("Disabling LVDS output\n");
90 90
91 if (!IS_ERR(tcon->panel)) { 91 if (tcon->panel) {
92 drm_panel_disable(tcon->panel); 92 drm_panel_disable(tcon->panel);
93 drm_panel_unprepare(tcon->panel); 93 drm_panel_unprepare(tcon->panel);
94 } 94 }
diff --git a/drivers/gpu/drm/sun4i/sun4i_rgb.c b/drivers/gpu/drm/sun4i/sun4i_rgb.c
index bf068da6b12e..f4a22689eb54 100644
--- a/drivers/gpu/drm/sun4i/sun4i_rgb.c
+++ b/drivers/gpu/drm/sun4i/sun4i_rgb.c
@@ -135,7 +135,7 @@ static void sun4i_rgb_encoder_enable(struct drm_encoder *encoder)
135 135
136 DRM_DEBUG_DRIVER("Enabling RGB output\n"); 136 DRM_DEBUG_DRIVER("Enabling RGB output\n");
137 137
138 if (!IS_ERR(tcon->panel)) { 138 if (tcon->panel) {
139 drm_panel_prepare(tcon->panel); 139 drm_panel_prepare(tcon->panel);
140 drm_panel_enable(tcon->panel); 140 drm_panel_enable(tcon->panel);
141 } 141 }
@@ -148,7 +148,7 @@ static void sun4i_rgb_encoder_disable(struct drm_encoder *encoder)
148 148
149 DRM_DEBUG_DRIVER("Disabling RGB output\n"); 149 DRM_DEBUG_DRIVER("Disabling RGB output\n");
150 150
151 if (!IS_ERR(tcon->panel)) { 151 if (tcon->panel) {
152 drm_panel_disable(tcon->panel); 152 drm_panel_disable(tcon->panel);
153 drm_panel_unprepare(tcon->panel); 153 drm_panel_unprepare(tcon->panel);
154 } 154 }
diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.c b/drivers/gpu/drm/sun4i/sun4i_tcon.c
index c78cd35a1294..f949287d926c 100644
--- a/drivers/gpu/drm/sun4i/sun4i_tcon.c
+++ b/drivers/gpu/drm/sun4i/sun4i_tcon.c
@@ -491,7 +491,8 @@ static void sun4i_tcon0_mode_set_rgb(struct sun4i_tcon *tcon,
491 sun4i_tcon0_mode_set_common(tcon, mode); 491 sun4i_tcon0_mode_set_common(tcon, mode);
492 492
493 /* Set dithering if needed */ 493 /* Set dithering if needed */
494 sun4i_tcon0_mode_set_dithering(tcon, tcon->panel->connector); 494 if (tcon->panel)
495 sun4i_tcon0_mode_set_dithering(tcon, tcon->panel->connector);
495 496
496 /* Adjust clock delay */ 497 /* Adjust clock delay */
497 clk_delay = sun4i_tcon_get_clk_delay(mode, 0); 498 clk_delay = sun4i_tcon_get_clk_delay(mode, 0);
@@ -555,7 +556,7 @@ static void sun4i_tcon0_mode_set_rgb(struct sun4i_tcon *tcon,
555 * Following code is a way to avoid quirks all around TCON 556 * Following code is a way to avoid quirks all around TCON
556 * and DOTCLOCK drivers. 557 * and DOTCLOCK drivers.
557 */ 558 */
558 if (!IS_ERR(tcon->panel)) { 559 if (tcon->panel) {
559 struct drm_panel *panel = tcon->panel; 560 struct drm_panel *panel = tcon->panel;
560 struct drm_connector *connector = panel->connector; 561 struct drm_connector *connector = panel->connector;
561 struct drm_display_info display_info = connector->display_info; 562 struct drm_display_info display_info = connector->display_info;