]> git.baikalelectronics.ru Git - kernel.git/commitdiff
drm/amd/display: prevent reading unitialized links
authorMikita Lipski <mikita.lipski@amd.com>
Mon, 15 Nov 2021 21:07:38 +0000 (16:07 -0500)
committerAlex Deucher <alexander.deucher@amd.com>
Thu, 9 Dec 2021 04:24:08 +0000 (23:24 -0500)
[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>
drivers/gpu/drm/amd/display/dc/dc_link.h

index b01077a6af0e6cdf95a376f90b0d9d2974081bdd..fad3d883ed891c14e50f110f28893fd70dec9902 100644 (file)
@@ -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)