From 58b0945cb74f9a446ee4d860fd77725eae1b508e Mon Sep 17 00:00:00 2001 From: Liu Ying Date: Tue, 22 Aug 2017 15:54:57 +0800 Subject: [PATCH] MLK-16240 drm/bridge: it6263: Don't use freed edid structure in ->get_modes() We call the helper drm_detect_hdmi_monitor() to check if the EDID blob read from a monitor indicates the monitor is connected via HDMI or not. We pass an edid structure to the helper. However, the structure has been freed before we use it. This patch moves the helper up before the structure is freed to fix the issue. Fixes: a5c01aa91842 ("MLK-15001-25 drm/bridge: Add ITE IT6263 LVDS to HDMI transmitter support") Signed-off-by: Liu Ying --- drivers/gpu/drm/bridge/it6263.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/gpu/drm/bridge/it6263.c b/drivers/gpu/drm/bridge/it6263.c index 2e5d5a25e3f9..d5aadbcd343b 100644 --- a/drivers/gpu/drm/bridge/it6263.c +++ b/drivers/gpu/drm/bridge/it6263.c @@ -474,6 +474,7 @@ static int it6263_get_modes(struct drm_connector *connector) drm_mode_connector_update_edid_property(connector, edid); if (edid) { num = drm_add_edid_modes(connector, edid); + it6263->is_hdmi = drm_detect_hdmi_monitor(edid); kfree(edid); } @@ -482,8 +483,6 @@ static int it6263_get_modes(struct drm_connector *connector) if (ret) return ret; - it6263->is_hdmi = drm_detect_hdmi_monitor(edid); - return num; } -- 2.17.1