summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorXiang Yang <xiangyang3@huawei.com>2023-08-12 14:27:48 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2024-01-20 11:50:06 +0100
commit1502a9a595e5990f067f0fcdad422f03b333a935 (patch)
tree1516dd36fcf0c46150e7d7e0af4316c8c726bf40 /drivers
parent92decec3caa76b29fa956627f457cc23fa5e6109 (diff)
downloadlinux-stable-1502a9a595e5990f067f0fcdad422f03b333a935.tar.gz
linux-stable-1502a9a595e5990f067f0fcdad422f03b333a935.tar.bz2
linux-stable-1502a9a595e5990f067f0fcdad422f03b333a935.zip
drm/exynos: fix a potential error pointer dereference
[ Upstream commit 73bf1c9ae6c054c53b8e84452c5e46f86dd28246 ] Smatch reports the warning below: drivers/gpu/drm/exynos/exynos_hdmi.c:1864 hdmi_bind() error: 'crtc' dereferencing possible ERR_PTR() The return value of exynos_drm_crtc_get_by_type maybe ERR_PTR(-ENODEV), which can not be used directly. Fix this by checking the return value before using it. Signed-off-by: Xiang Yang <xiangyang3@huawei.com> Signed-off-by: Inki Dae <inki.dae@samsung.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/gpu/drm/exynos/exynos_hdmi.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c b/drivers/gpu/drm/exynos/exynos_hdmi.c
index b7c11bdce2c8..1a7194a653ae 100644
--- a/drivers/gpu/drm/exynos/exynos_hdmi.c
+++ b/drivers/gpu/drm/exynos/exynos_hdmi.c
@@ -1861,6 +1861,8 @@ static int hdmi_bind(struct device *dev, struct device *master, void *data)
return ret;
crtc = exynos_drm_crtc_get_by_type(drm_dev, EXYNOS_DISPLAY_TYPE_HDMI);
+ if (IS_ERR(crtc))
+ return PTR_ERR(crtc);
crtc->pipe_clk = &hdata->phy_clk;
ret = hdmi_create_connector(encoder);