Skip to content

Commit 7f4cedd

Browse files
giuliobenettimripard
authored andcommitted
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
1 parent 6510223 commit 7f4cedd

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

drivers/gpu/drm/sun4i/sun4i_lvds.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ static void sun4i_lvds_encoder_enable(struct drm_encoder *encoder)
7575

7676
DRM_DEBUG_DRIVER("Enabling LVDS output\n");
7777

78-
if (!IS_ERR(tcon->panel)) {
78+
if (tcon->panel) {
7979
drm_panel_prepare(tcon->panel);
8080
drm_panel_enable(tcon->panel);
8181
}
@@ -88,7 +88,7 @@ static void sun4i_lvds_encoder_disable(struct drm_encoder *encoder)
8888

8989
DRM_DEBUG_DRIVER("Disabling LVDS output\n");
9090

91-
if (!IS_ERR(tcon->panel)) {
91+
if (tcon->panel) {
9292
drm_panel_disable(tcon->panel);
9393
drm_panel_unprepare(tcon->panel);
9494
}

drivers/gpu/drm/sun4i/sun4i_rgb.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ static void sun4i_rgb_encoder_enable(struct drm_encoder *encoder)
135135

136136
DRM_DEBUG_DRIVER("Enabling RGB output\n");
137137

138-
if (!IS_ERR(tcon->panel)) {
138+
if (tcon->panel) {
139139
drm_panel_prepare(tcon->panel);
140140
drm_panel_enable(tcon->panel);
141141
}
@@ -148,7 +148,7 @@ static void sun4i_rgb_encoder_disable(struct drm_encoder *encoder)
148148

149149
DRM_DEBUG_DRIVER("Disabling RGB output\n");
150150

151-
if (!IS_ERR(tcon->panel)) {
151+
if (tcon->panel) {
152152
drm_panel_disable(tcon->panel);
153153
drm_panel_unprepare(tcon->panel);
154154
}

drivers/gpu/drm/sun4i/sun4i_tcon.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -555,7 +555,7 @@ static void sun4i_tcon0_mode_set_rgb(struct sun4i_tcon *tcon,
555555
* Following code is a way to avoid quirks all around TCON
556556
* and DOTCLOCK drivers.
557557
*/
558-
if (!IS_ERR(tcon->panel)) {
558+
if (tcon->panel) {
559559
struct drm_panel *panel = tcon->panel;
560560
struct drm_connector *connector = panel->connector;
561561
struct drm_display_info display_info = connector->display_info;

0 commit comments

Comments
 (0)