Skip to content

Commit

Permalink
ASoC: Move kfree(twl4030) to twl4030_soc_remove()
Browse files Browse the repository at this point in the history
As we allocate memory for twl4030 in twl4030_codec_probe(),
twl4030_codec_remove() is a better place to free the memory.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
  • Loading branch information
Axel Lin authored and Liam Girdwood committed Nov 19, 2010
1 parent 0656f6c commit 5b3b0fa
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions sound/soc/codecs/twl4030.c
Original file line number Diff line number Diff line change
Expand Up @@ -2272,9 +2272,12 @@ static int twl4030_soc_probe(struct snd_soc_codec *codec)

static int twl4030_soc_remove(struct snd_soc_codec *codec)
{
struct twl4030_priv *twl4030 = snd_soc_codec_get_drvdata(codec);

/* Reset registers to their chip default before leaving */
twl4030_reset_registers(codec);
twl4030_set_bias_level(codec, SND_SOC_BIAS_OFF);
kfree(twl4030);
return 0;
}

Expand Down Expand Up @@ -2306,10 +2309,7 @@ static int __devinit twl4030_codec_probe(struct platform_device *pdev)

static int __devexit twl4030_codec_remove(struct platform_device *pdev)
{
struct twl4030_priv *twl4030 = dev_get_drvdata(&pdev->dev);

snd_soc_unregister_codec(&pdev->dev);
kfree(twl4030);
return 0;
}

Expand Down

0 comments on commit 5b3b0fa

Please sign in to comment.