]> git.hungrycats.org Git - linux/commit
ASoC: mediatek: mt8189: Fix probe resource cleanup
authorCássio Gabriel <cassiogabrielcontato@gmail.com>
Thu, 14 May 2026 13:52:35 +0000 (10:52 -0300)
committerMark Brown <broonie@kernel.org>
Fri, 22 May 2026 12:30:35 +0000 (13:30 +0100)
commit5404599c3292a12dfc6a3b604cebb5d51064f553
treeb4adbb705a5c861afa8767e341ee796779765c3e
parent8fbcb4ab267059fedd5e087160cb208b61ab8128
ASoC: mediatek: mt8189: Fix probe resource cleanup

The MT8189 AFE probe assigns reserved memory with
of_reserved_mem_device_init(), but only releases that assignment from
.remove().  If probe fails after the reserved memory has been assigned,
the assignment record is left behind.

The probe path also uses pm_runtime_get_sync() without checking its
return value.  If runtime resume fails, pm_runtime_get_sync() leaves the
usage count incremented and the driver continues initialization without
the device being resumed.  Use pm_runtime_resume_and_get() so resume
errors abort probe without leaking a PM usage count.

Finally, component registration failure currently jumps to a label that
drops a runtime PM reference even though the temporary probe reference
was already released.  Return the component registration error directly,
and do not drop an unmatched PM reference from .remove().

Fixes: 7eb153585598 ("ASoC: mediatek: mt8189: add platform driver")
Signed-off-by: Cássio Gabriel <cassiogabrielcontato@gmail.com>
Link: https://patch.msgid.link/20260514-asoc-mt8189-probe-cleanup-v1-1-ded733363281@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/mediatek/mt8189/mt8189-afe-pcm.c