aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJani Nikula <[email protected]>2023-09-14 18:53:17 +0300
committerChun-Kuang Hu <[email protected]>2023-09-24 14:19:44 +0000
commitdab12fa8d2bd3868cf2de485ed15a3feef28a13d (patch)
tree5ba2a4a53301380c48df8445db4089a10a0cac49
parent350c3fe907fbfccb534198d69a580f5fef4ab834 (diff)
drm/mediatek/dp: fix memory leak on ->get_edid callback audio detection
The sads returned by drm_edid_to_sad() needs to be freed. Fixes: e71a8ebbe086 ("drm/mediatek: dp: Audio support for MT8195") Cc: Guillaume Ranquet <[email protected]> Cc: Bo-Chen Chen <[email protected]> Cc: AngeloGioacchino Del Regno <[email protected]> Cc: Dmitry Osipenko <[email protected]> Cc: Chun-Kuang Hu <[email protected]> Cc: Philipp Zabel <[email protected]> Cc: Matthias Brugger <[email protected]> Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: <[email protected]> # v6.1+ Signed-off-by: Jani Nikula <[email protected]> Reviewed-by: Chen-Yu Tsai <[email protected]> Link: https://patchwork.kernel.org/project/dri-devel/patch/[email protected]/ Signed-off-by: Chun-Kuang Hu <[email protected]>
-rw-r--r--drivers/gpu/drm/mediatek/mtk_dp.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/gpu/drm/mediatek/mtk_dp.c b/drivers/gpu/drm/mediatek/mtk_dp.c
index 93f6f8efabd6..da023de5317a 100644
--- a/drivers/gpu/drm/mediatek/mtk_dp.c
+++ b/drivers/gpu/drm/mediatek/mtk_dp.c
@@ -2049,7 +2049,6 @@ static struct edid *mtk_dp_get_edid(struct drm_bridge *bridge,
bool enabled = mtk_dp->enabled;
struct edid *new_edid = NULL;
struct mtk_dp_audio_cfg *audio_caps = &mtk_dp->info.audio_cur_cfg;
- struct cea_sad *sads;
if (!enabled) {
drm_atomic_bridge_chain_pre_enable(bridge, connector->state->state);
@@ -2068,7 +2067,11 @@ static struct edid *mtk_dp_get_edid(struct drm_bridge *bridge,
}
if (new_edid) {
+ struct cea_sad *sads;
+
audio_caps->sad_count = drm_edid_to_sad(new_edid, &sads);
+ kfree(sads);
+
audio_caps->detect_monitor = drm_detect_monitor_audio(new_edid);
}