summaryrefslogtreecommitdiffstats
path: root/drivers/gpu
diff options
context:
space:
mode:
authorMikita Lipski <mikita.lipski@amd.com>2021-11-15 22:07:38 +0100
committerAlex Deucher <alexander.deucher@amd.com>2021-12-09 05:24:08 +0100
commit0755c38eb007196a5f779298b4a5f46c4eec41d2 (patch)
tree0b448db4131dc6b4bab4871d962d7f76a7275bfe /drivers/gpu
parentdrm/amd/display: Fix DPIA outbox timeout after S3/S4/reset (diff)
downloadlinux-0755c38eb007196a5f779298b4a5f46c4eec41d2.tar.xz
linux-0755c38eb007196a5f779298b4a5f46c4eec41d2.zip
drm/amd/display: prevent reading unitialized links
[why/how] The function can be called on boot or after suspend when links are not initialized, to prevent it guard it with NULL pointer check Reviewed-by: Nicholas Kazlauskas <Nicholas.Kazlauskas@amd.com> Acked-by: Pavle Kotarac <Pavle.Kotarac@amd.com> Signed-off-by: Mikita Lipski <mikita.lipski@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/drm/amd/display/dc/dc_link.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/gpu/drm/amd/display/dc/dc_link.h b/drivers/gpu/drm/amd/display/dc/dc_link.h
index b01077a6af0e..fad3d883ed89 100644
--- a/drivers/gpu/drm/amd/display/dc/dc_link.h
+++ b/drivers/gpu/drm/amd/display/dc/dc_link.h
@@ -226,6 +226,8 @@ static inline void get_edp_links(const struct dc *dc,
*edp_num = 0;
for (i = 0; i < dc->link_count; i++) {
// report any eDP links, even unconnected DDI's
+ if (!dc->links[i])
+ continue;
if (dc->links[i]->connector_signal == SIGNAL_TYPE_EDP) {
edp_links[*edp_num] = dc->links[i];
if (++(*edp_num) == MAX_NUM_EDP)