diff options
author | Chen-Yu Tsai <wens@csie.org> | 2016-09-01 14:13:32 +0800 |
---|---|---|
committer | Maxime Ripard <maxime.ripard@free-electrons.com> | 2016-09-01 18:46:06 +0200 |
commit | b5644a5e72f0a18c0cddf887bec1e1370cf67a8c (patch) | |
tree | 08b58bd05ffaa200c237d5bffeab0743742c62d0 | |
parent | 4b30950252265140139ce441fd7d8743d1d6052e (diff) | |
download | linux-stable-b5644a5e72f0a18c0cddf887bec1e1370cf67a8c.tar.gz linux-stable-b5644a5e72f0a18c0cddf887bec1e1370cf67a8c.tar.bz2 linux-stable-b5644a5e72f0a18c0cddf887bec1e1370cf67a8c.zip |
drm/sun4i: Clear encoder->bridge if a bridge is not found
The KMS helpers (drm_atomic_helper_check_modeset/mode_fixup) pass
encoder->bridge directly to drm_bridge_mode_fixup, which expects a
valid pointer, or NULL (in which case it just returns).
Clear encoder->bridge if a bridge is not found, instead of keeping
the ERR_PTR value.
Since other drm_bridge functions also follow this pattern of checking
for a non-NULL pointer, we can drop the ifs around the calls and just
pass the pointer directly.
Fixes: 894f5a9f4b4a ("drm/sun4i: Add bridge support")
Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
-rw-r--r-- | drivers/gpu/drm/sun4i/sun4i_rgb.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/drivers/gpu/drm/sun4i/sun4i_rgb.c b/drivers/gpu/drm/sun4i/sun4i_rgb.c index c07697902ab1..bc6eef27c12b 100644 --- a/drivers/gpu/drm/sun4i/sun4i_rgb.c +++ b/drivers/gpu/drm/sun4i/sun4i_rgb.c @@ -156,8 +156,8 @@ static void sun4i_rgb_encoder_enable(struct drm_encoder *encoder) drm_panel_enable(tcon->panel); } - if (!IS_ERR(encoder->bridge)) - drm_bridge_enable(encoder->bridge); + /* encoder->bridge can be NULL; drm_bridge_enable checks for it */ + drm_bridge_enable(encoder->bridge); sun4i_tcon_channel_enable(tcon, 0); } @@ -172,8 +172,8 @@ static void sun4i_rgb_encoder_disable(struct drm_encoder *encoder) sun4i_tcon_channel_disable(tcon, 0); - if (!IS_ERR(encoder->bridge)) - drm_bridge_disable(encoder->bridge); + /* encoder->bridge can be NULL; drm_bridge_disable checks for it */ + drm_bridge_disable(encoder->bridge); if (!IS_ERR(tcon->panel)) { drm_panel_disable(tcon->panel); @@ -278,6 +278,8 @@ int sun4i_rgb_init(struct drm_device *drm) dev_err(drm->dev, "Couldn't attach our bridge\n"); goto err_cleanup_connector; } + } else { + encoder->bridge = NULL; } return 0; |