]> git.baikalelectronics.ru Git - kernel.git/commit
ASoC: hdac_hda: fix memleak on module unload
authorKai Vehmanen <kai.vehmanen@linux.intel.com>
Fri, 17 Jul 2020 10:19:49 +0000 (13:19 +0300)
committerMark Brown <broonie@kernel.org>
Wed, 22 Jul 2020 13:31:57 +0000 (14:31 +0100)
commit439bce1a8c7f1e81566dd8f6467e9f97a10c3896
tree03281b62c60e2ff4ed47fb5b1bb1cd3d361ad5fe
parent9103c6518f8c5c1eef94332efb2deb019330a46b
ASoC: hdac_hda: fix memleak on module unload

The hdac_hda remove implementation fails to free the hda codec
resources, leading to memleaks at module unload. This gap has been there
from the start, commit daad49001b5b ("ASoC: hdac_hda: add asoc
extension for legacy HDA codec drivers").

Instead of duplicating the cleanup logic, use the common
snd_hda_codec_cleanup_for_unbind() to free the resources. Remove
existing code in hdac_hda to cleanup "codec.jackpoll_work" and call to
snd_hdac_regmap_exit(), as these are already done in
snd_hda_codec_cleanup_for_unbind().

The cleanup is done in ASoC component remove() callback and not in the
HDAC bus hdev_detach(). This is done to ensure the codec specific
cleanup routines are run before the parent card is freed.

Fixes: daad49001b5b ("ASoC: hdac_hda: add asoc extension for legacy HDA codec drivers")
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
BugLink: https://github.com/thesofproject/linux/issues/2195
Link: https://lore.kernel.org/r/20200717101950.3885187-2-kai.vehmanen@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/codecs/hdac_hda.c