diff options
author | Giulio Benetti <giulio.benetti@micronovasrl.com> | 2018-10-05 17:59:50 -0400 |
---|---|---|
committer | Maxime Ripard <maxime.ripard@bootlin.com> | 2018-11-06 10:55:24 -0500 |
commit | 7f4cedd882f7cae83177066c2b239ef457ce4a42 (patch) | |
tree | 016de1a53bbe2bc25c70ce834533089fac2db49f | |
parent | 651022382c7f8da46cb4872a545ee1da6d097d2a (diff) |
drm/sun4i: tcon: fix check of tcon->panel null pointer
Since tcon->panel is a pointer returned by of_drm_find_panel() need to
check if it is not NULL, hence a valid pointer.
IS_ERR() instead checks return error values, not NULL pointers.
Substitute "if (!IS_ERR(tcon->panel))" with "if (tcon->panel)".
Signed-off-by: Giulio Benetti <giulio.benetti@micronovasrl.com>
Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20181005215951.99003-1-giulio.benetti@micronovasrl.com
-rw-r--r-- | drivers/gpu/drm/sun4i/sun4i_lvds.c | 4 | ||||
-rw-r--r-- | drivers/gpu/drm/sun4i/sun4i_rgb.c | 4 | ||||
-rw-r--r-- | drivers/gpu/drm/sun4i/sun4i_tcon.c | 2 |
3 files changed, 5 insertions, 5 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..e4b3bd0307ef 100644 --- a/drivers/gpu/drm/sun4i/sun4i_tcon.c +++ b/drivers/gpu/drm/sun4i/sun4i_tcon.c | |||
@@ -555,7 +555,7 @@ static void sun4i_tcon0_mode_set_rgb(struct sun4i_tcon *tcon, | |||
555 | * Following code is a way to avoid quirks all around TCON | 555 | * Following code is a way to avoid quirks all around TCON |
556 | * and DOTCLOCK drivers. | 556 | * and DOTCLOCK drivers. |
557 | */ | 557 | */ |
558 | if (!IS_ERR(tcon->panel)) { | 558 | if (tcon->panel) { |
559 | struct drm_panel *panel = tcon->panel; | 559 | struct drm_panel *panel = tcon->panel; |
560 | struct drm_connector *connector = panel->connector; | 560 | struct drm_connector *connector = panel->connector; |
561 | struct drm_display_info display_info = connector->display_info; | 561 | struct drm_display_info display_info = connector->display_info; |