]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
drm/mediatek: mtk_hdmi: Unregister audio platform device on failure
authorAngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Mon, 17 Feb 2025 15:48:10 +0000 (16:48 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 10 Apr 2025 12:33:32 +0000 (14:33 +0200)
commit61270882c581c6eb9a3d86575a693670b9fb85d5
treef62f5e39cac8a3d2623adb444b14b7daf305985d
parentc08869bf69c4a42110ef90b8dd898777fe9233b3
drm/mediatek: mtk_hdmi: Unregister audio platform device on failure

[ Upstream commit 0be123cafc06eed0fd1227166a66e786434b0c50 ]

The probe function of this driver may fail after registering the
audio platform device: in that case, the state is not getting
cleaned up, leaving this device registered.

Adding up to the mix, should the probe function of this driver
return a probe deferral for N times, we're registering up to N
audio platform devices and, again, never freeing them up.

To fix this, add a pointer to the audio platform device in the
mtk_hdmi structure, and add a devm action to unregister it upon
driver removal or probe failure.

Fixes: 8f83f26891e1 ("drm/mediatek: Add HDMI support")
Reviewed-by: CK Hu <ck.hu@mediatek.com>
Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Link: https://patchwork.kernel.org/project/linux-mediatek/patch/20250217154836.108895-18-angelogioacchino.delregno@collabora.com/
Signed-off-by: Chun-Kuang Hu <chunkuang.hu@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/gpu/drm/mediatek/mtk_hdmi.c