Skip to contentSkip to conversation

ASoC: TWL4030: Module unloading fix

PATCH Applied Peter Ujfalusi 3 participants 3 messages Feb 4, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ASoC: TWL4030: Module unloading fix

The module unloading path had several problems:
- it freed up the private structure twice
- it freed up the codec structure, which was allocated as part of the private structure
- it did not freed up the reg_cache
- it did not unregistered the dais and the codec

---
 sound/soc/codecs/twl4030.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
sound/soc/codecs/twl4030.c +3 -2
index e0106a5..b32aeb3 100644
@@ -2152,8 +2152,6 @@ static int twl4030_soc_remove(struct platform_device *pdev)
 	twl4030_set_bias_level(codec, SND_SOC_BIAS_OFF);
 	snd_soc_free_pcms(socdev);
 	snd_soc_dapm_free(socdev);
-	kfree(codec->private_data);
-	kfree(codec);
 
 	return 0;
 }
@@ -2237,6 +2235,9 @@ static int __devexit twl4030_codec_remove(struct platform_device *pdev)
 {
 	struct twl4030_priv *twl4030 = platform_get_drvdata(pdev);
 
+	snd_soc_unregister_dais(&twl4030_dai[0], ARRAY_SIZE(twl4030_dai));
+	snd_soc_unregister_codec(&twl4030->codec);
+	kfree(twl4030->codec.reg_cache);
 	kfree(twl4030);
 
 	twl4030_codec = NULL;
Signature · 1 line
1.6.6.1
Acked-by on v1 1/1
#1 lore raw
Quoted 9 lines · Peter Ujfalusi

The module unloading path had several problems:
- it freed up the private structure twice
- it freed up the codec structure, which was allocated as part of the private structure
- it did not freed up the reg_cache
- it did not unregistered the dais and the codec

---

Signature · 3 lines
Freelance Developer, SlimLogic Ltd
ASoC and Voltage Regulator Maintainer.
http://www.slimlogic.co.uk
Applied
#2 lore raw
In reply to Peter Ujfalusi
Quoted 8 lines · Peter Ujfalusi

The module unloading path had several problems:
- it freed up the private structure twice
- it freed up the codec structure, which was allocated as part of the private structure
- it did not freed up the reg_cache
- it did not unregistered the dais and the codec

Applied, thanks.