From: Richard Chiang <[email protected]>

[Why]
When sink EDID data pointer is NULL, it will cause an
unexpected error.

[How]
Check data pointer is not NULL first.

Reviewed-by: Yihan Zhu <[email protected]>
Signed-off-by: Richard Chiang <[email protected]>
Signed-off-by: Chenyu Chen <[email protected]>
---
 drivers/gpu/drm/amd/display/dc/link/link_detection.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/gpu/drm/amd/display/dc/link/link_detection.c 
b/drivers/gpu/drm/amd/display/dc/link/link_detection.c
index 373e68cf2bde..080642dfde2a 100644
--- a/drivers/gpu/drm/amd/display/dc/link/link_detection.c
+++ b/drivers/gpu/drm/amd/display/dc/link/link_detection.c
@@ -623,6 +623,9 @@ static bool detect_dp(struct dc_link *link,
 
 static bool is_same_edid(struct dc_edid *old_edid, struct dc_edid *new_edid)
 {
+       if (old_edid == NULL || new_edid == NULL)
+               return false;
+
        if (old_edid->length != new_edid->length)
                return false;
 
-- 
2.43.0

Reply via email to