summaryrefslogtreecommitdiffstats
path: root/drivers/gpu
diff options
context:
space:
mode:
authorZeng Jingxiang <linuszeng@tencent.com>2022-07-27 15:31:19 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2022-10-21 12:39:12 +0200
commit912f84e15e94ab87f5a7156aa1870090373d8304 (patch)
tree6e1452a707bd0975ddc80121488a3130ae469a77 /drivers/gpu
parent5121d040d385ad5f4640275ca0e42e2fdf597127 (diff)
downloadlinux-stable-912f84e15e94ab87f5a7156aa1870090373d8304.tar.gz
linux-stable-912f84e15e94ab87f5a7156aa1870090373d8304.tar.bz2
linux-stable-912f84e15e94ab87f5a7156aa1870090373d8304.zip
gpu: lontium-lt9611: Fix NULL pointer dereference in lt9611_connector_init()
[ Upstream commit ef8886f321c5dab8124b9153d25afa2a71d05323 ] A NULL check for bridge->encoder shows that it may be NULL, but it already been dereferenced on all paths leading to the check. 812 if (!bridge->encoder) { Dereference the pointer bridge->encoder. 810 drm_connector_attach_encoder(&lt9611->connector, bridge->encoder); Signed-off-by: Zeng Jingxiang <linuszeng@tencent.com> Signed-off-by: Robert Foss <robert.foss@linaro.org> Link: https://patchwork.freedesktop.org/patch/msgid/20220727073119.1578972-1-zengjx95@gmail.com Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/drm/bridge/lontium-lt9611.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/gpu/drm/bridge/lontium-lt9611.c b/drivers/gpu/drm/bridge/lontium-lt9611.c
index 8a60e83482a0..5fccacc159f0 100644
--- a/drivers/gpu/drm/bridge/lontium-lt9611.c
+++ b/drivers/gpu/drm/bridge/lontium-lt9611.c
@@ -813,13 +813,14 @@ static int lt9611_connector_init(struct drm_bridge *bridge, struct lt9611 *lt961
drm_connector_helper_add(&lt9611->connector,
&lt9611_bridge_connector_helper_funcs);
- drm_connector_attach_encoder(&lt9611->connector, bridge->encoder);
if (!bridge->encoder) {
DRM_ERROR("Parent encoder object not found");
return -ENODEV;
}
+ drm_connector_attach_encoder(&lt9611->connector, bridge->encoder);
+
return 0;
}