drm/mediatek/dp: Fix spurious kfree()
authorMichael Walle <mwalle@kernel.org>
Tue, 4 Jun 2024 08:33:37 +0000 (10:33 +0200)
committerChun-Kuang Hu <chunkuang.hu@kernel.org>
Fri, 28 Jun 2024 13:01:43 +0000 (13:01 +0000)
commit8ad49a92cff4bab13eb2f2725243f5f31eff3f3b
treed2991d94a52d101d35a3366896e8670d124b549e
parent9ff6df49e6cbcc9834865870d7c4f3059b0891d3
drm/mediatek/dp: Fix spurious kfree()

drm_edid_to_sad() might return an error or just zero. If that is the
case, we must not free the SADs because there was no allocation in
the first place.

Fixes: dab12fa8d2bd ("drm/mediatek/dp: fix memory leak on ->get_edid callback audio detection")
Signed-off-by: Michael Walle <mwalle@kernel.org>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Link: https://patchwork.kernel.org/project/linux-mediatek/patch/20240604083337.1879188-1-mwalle@kernel.org/
Signed-off-by: Chun-Kuang Hu <chunkuang.hu@kernel.org>
drivers/gpu/drm/mediatek/mtk_dp.c