If drm_edid_connector_update() fails, hdmi_get_modes() returns
without freeing the EDID allocated by drm_edid_read_ddc(). It's
an unlikely error path but nevertheless possible and should be
cleaned up fully.

Free the EDID before returning, while keeping the existing return
value of 0.

Fixes: f6e4f57fd90dc ("drm/exynos: hdmi: convert to struct drm_edid")
Signed-off-by: Avi Weiss <[email protected]>
---
 drivers/gpu/drm/exynos/exynos_hdmi.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c 
b/drivers/gpu/drm/exynos/exynos_hdmi.c
index d4fce39c2b61..386557a7f5e8 100644
--- a/drivers/gpu/drm/exynos/exynos_hdmi.c
+++ b/drivers/gpu/drm/exynos/exynos_hdmi.c
@@ -893,8 +893,10 @@ static int hdmi_get_modes(struct drm_connector *connector)
        drm_edid = drm_edid_read_ddc(connector, hdata->ddc_adpt);
 
        ret = drm_edid_connector_update(connector, drm_edid);
-       if (ret)
+       if (ret) {
+               drm_edid_free(drm_edid);
                return 0;
+       }
 
        cec_notifier_set_phys_addr(hdata->notifier, 
info->source_physical_address);
 

base-commit: 24a19b953e2a3d0ea5a8c4951a0ab8f32720c907
-- 
2.43.0

Reply via email to