Skip to content

Commit dab12fa

Browse files
jnikulaChun-Kuang Hu
authored andcommitted
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: e71a8eb ("drm/mediatek: dp: Audio support for MT8195") Cc: Guillaume Ranquet <granquet@baylibre.com> Cc: Bo-Chen Chen <rex-bc.chen@mediatek.com> Cc: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Cc: Dmitry Osipenko <dmitry.osipenko@collabora.com> Cc: Chun-Kuang Hu <chunkuang.hu@kernel.org> Cc: Philipp Zabel <p.zabel@pengutronix.de> Cc: Matthias Brugger <matthias.bgg@gmail.com> Cc: dri-devel@lists.freedesktop.org Cc: linux-mediatek@lists.infradead.org Cc: linux-kernel@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org Cc: <stable@vger.kernel.org> # v6.1+ Signed-off-by: Jani Nikula <jani.nikula@intel.com> Reviewed-by: Chen-Yu Tsai <wenst@chromium.org> Link: https://patchwork.kernel.org/project/dri-devel/patch/20230914155317.2511876-1-jani.nikula@intel.com/ Signed-off-by: Chun-Kuang Hu <chunkuang.hu@kernel.org>
1 parent 350c3fe commit dab12fa

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

drivers/gpu/drm/mediatek/mtk_dp.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2049,7 +2049,6 @@ static struct edid *mtk_dp_get_edid(struct drm_bridge *bridge,
20492049
bool enabled = mtk_dp->enabled;
20502050
struct edid *new_edid = NULL;
20512051
struct mtk_dp_audio_cfg *audio_caps = &mtk_dp->info.audio_cur_cfg;
2052-
struct cea_sad *sads;
20532052

20542053
if (!enabled) {
20552054
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,
20682067
}
20692068

20702069
if (new_edid) {
2070+
struct cea_sad *sads;
2071+
20712072
audio_caps->sad_count = drm_edid_to_sad(new_edid, &sads);
2073+
kfree(sads);
2074+
20722075
audio_caps->detect_monitor = drm_detect_monitor_audio(new_edid);
20732076
}
20742077

0 commit comments

Comments
 (0)