Skip to contentSkip to conversation

ASoC: pxa-ssp: fix a memory leak in pxa_ssp_remove()

PATCH In review Axel Lin 3 participants 5 messages Aug 25, 2010 – Aug 26, 2010

Subsystems (3)
lore
Share & tools
lore

Axel Lin

author
#0 lore raw

PATCH 1/1 ASoC: pxa-ssp: fix a memory leak in pxa_ssp_remove()

The "priv" allocated in pxa_ssp_probe() should be kfreed in pxa_ssp_remove().

---
This patch is against 2.6.36-rc2-git3.

 sound/soc/pxa/pxa-ssp.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
sound/soc/pxa/pxa-ssp.c +1 -0
index a1fd23e..2a9cac7 100644
@@ -760,6 +760,7 @@ static void pxa_ssp_remove(struct platform_device *pdev,
 {
 	struct ssp_priv *priv = dai->private_data;
 	pxa_ssp_free(priv->ssp);
+	kfree(priv);
 }
 
 #define PXA_SSP_RATES (SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_11025 |\
Signature · 1 line
1.7.2
Acked-by on v1 1/1
#1 lore raw
Quoted 13 lines · Axel Lin

The "priv" allocated in pxa_ssp_probe() should be kfreed in pxa_ssp_remove().

---
This patch is against 2.6.36-rc2-git3.

 sound/soc/pxa/pxa-ssp.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
sound/soc/pxa/pxa-ssp.c +0 -0
index a1fd23e..2a9cac7 100644

sound/soc/pxa/pxa-ssp.c static void pxa_ssp_remove(struct platform_device *pdev, · line 766

Quoted 7 lines
sound/soc/pxa/pxa-ssp.c +1 -0
@@ -760,6 +760,7 @@ static void pxa_ssp_remove(struct platform_device *pdev,
 {
 	struct ssp_priv *priv = dai->private_data;
 	pxa_ssp_free(priv->ssp);
+	kfree(priv);
 }
 
 #define PXA_SSP_RATES (SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_11025 |\
Signature · 3 lines
Freelance Developer, SlimLogic Ltd
ASoC and Voltage Regulator Maintainer.
http://www.slimlogic.co.uk
#2 lore raw
In reply to Axel Lin
Quoted 3 lines · Axel Lin

The "priv" allocated in pxa_ssp_probe() should be kfreed in pxa_ssp_remove().

This doesn't apply against current ASoC. I fixed this up by hand since the error was so trivial but in future could you please make sure you generate your code against the latest version of ASoC? This will be in -next at any given time, or for the individual tree you want the latest for-2.6.nn branch of:

git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound-2.6.git

author
#3 lore raw

2010/8/25 Mark Brown <[email protected]>:

Quoted 5 lines · Axel Lin
Quoted 3 lines

The "priv" allocated in pxa_ssp_probe() should be kfreed in pxa_ssp_remove().

Quoted 8 lines

This doesn't apply against current ASoC.  I fixed this up by hand since the error was so trivial but in future could you please make sure you generate your code against the latest version of ASoC?  This will be in -next at any given time, or for the individual tree you want the latest for-2.6.nn branch of:

 git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound-2.6.git

Thanks, Mark.
I just thought this fix should be applied to 2.6.36. And ASoC tree will have this fix after merge 2.6.36.

Regards,
Axel

#4 lore raw
Quoted 2 lines · Axel Lin

I just thought this fix should be applied to 2.6.36. And ASoC tree will have this fix after merge 2.6.36.

It's a memory leak on unload for a driver for a device integrated into an embedded SoC - I'd be astonished if anyone managed to run into it in production.