ASoC: mediatek: mt6359: Fix unexpected error in bind/unbind flow
authorTrevor Wu <trevor.wu@mediatek.com>
Wed, 15 Sep 2021 03:46:59 +0000 (11:46 +0800)
committerMark Brown <broonie@kernel.org>
Wed, 15 Sep 2021 12:12:29 +0000 (13:12 +0100)
mt6359-sound is a MFD driver. Because its regmap is retrieved from its
parent, it shouldn't be freed in mt6359-sound driver.

snd_soc_component_exit_regmap() will do regmap_exit(), this results in
unexpected results if sound card unregister flow is invoked when users
try to bind/unbind audio codec.

Remove the usage of snd_soc_component_exit_regmap(). Instead, set
component->regmap = NULL in the component remove function.

Signed-off-by: Trevor Wu <trevor.wu@mediatek.com>
Link: https://lore.kernel.org/r/20210915034659.25044-1-trevor.wu@mediatek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/codecs/mt6359.c

index 2d6a4a29b850704df430906491b497254c66048a..f8532aa7e4aa03704b03e63232061e0452e61a90 100644 (file)
@@ -2697,7 +2697,7 @@ static int mt6359_codec_probe(struct snd_soc_component *cmpnt)
 
 static void mt6359_codec_remove(struct snd_soc_component *cmpnt)
 {
-       snd_soc_component_exit_regmap(cmpnt);
+       cmpnt->regmap = NULL;
 }
 
 static const DECLARE_TLV_DB_SCALE(hp_playback_tlv, -2200, 100, 0);