summaryrefslogtreecommitdiff
path: root/sound/soc/atmel
diff options
context:
space:
mode:
authorAxel Lin <axel.lin@gmail.com>2010-11-25 15:11:03 +0800
committerMark Brown <broonie@opensource.wolfsonmicro.com>2010-11-25 11:09:19 +0000
commitc7a734e58ed237ecac2608a70eb31ba64e21c768 (patch)
tree96f7e8b3ea3ecd62f7cdf33917a75cb55294aeb2 /sound/soc/atmel
parentb193deead8637291138a8c1c49753ee686fa5b17 (diff)
ASoC: sam9g20_wm8731: fix resource leak in at91sam9g20ek_init error path
Fix the error path to properly free allocated resources. Signed-off-by: Axel Lin <axel.lin@gmail.com> Acked-by: Liam Girdwood <lrg@slimlogic.co.uk> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc/atmel')
-rw-r--r--sound/soc/atmel/sam9g20_wm8731.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/sound/soc/atmel/sam9g20_wm8731.c b/sound/soc/atmel/sam9g20_wm8731.c
index 032e17dd8fdb..e521ada80542 100644
--- a/sound/soc/atmel/sam9g20_wm8731.c
+++ b/sound/soc/atmel/sam9g20_wm8731.c
@@ -240,6 +240,7 @@ static int __init at91sam9g20ek_init(void)
if (!at91sam9g20ek_snd_device) {
printk(KERN_ERR "ASoC: Platform device allocation failed\n");
ret = -ENOMEM;
+ goto err_mclk;
}
platform_set_drvdata(at91sam9g20ek_snd_device,
@@ -248,11 +249,13 @@ static int __init at91sam9g20ek_init(void)
ret = platform_device_add(at91sam9g20ek_snd_device);
if (ret) {
printk(KERN_ERR "ASoC: Platform device allocation failed\n");
- platform_device_put(at91sam9g20ek_snd_device);
+ goto err_device_add;
}
return ret;
+err_device_add:
+ platform_device_put(at91sam9g20ek_snd_device);
err_mclk:
clk_put(mclk);
mclk = NULL;