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>
This commit is contained in:
parent
b193deead8
commit
c7a734e58e
1 changed files with 4 additions and 1 deletions
|
@ -240,6 +240,7 @@ static int __init at91sam9g20ek_init(void)
|
||||||
if (!at91sam9g20ek_snd_device) {
|
if (!at91sam9g20ek_snd_device) {
|
||||||
printk(KERN_ERR "ASoC: Platform device allocation failed\n");
|
printk(KERN_ERR "ASoC: Platform device allocation failed\n");
|
||||||
ret = -ENOMEM;
|
ret = -ENOMEM;
|
||||||
|
goto err_mclk;
|
||||||
}
|
}
|
||||||
|
|
||||||
platform_set_drvdata(at91sam9g20ek_snd_device,
|
platform_set_drvdata(at91sam9g20ek_snd_device,
|
||||||
|
@ -248,11 +249,13 @@ static int __init at91sam9g20ek_init(void)
|
||||||
ret = platform_device_add(at91sam9g20ek_snd_device);
|
ret = platform_device_add(at91sam9g20ek_snd_device);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
printk(KERN_ERR "ASoC: Platform device allocation failed\n");
|
printk(KERN_ERR "ASoC: Platform device allocation failed\n");
|
||||||
platform_device_put(at91sam9g20ek_snd_device);
|
goto err_device_add;
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
|
err_device_add:
|
||||||
|
platform_device_put(at91sam9g20ek_snd_device);
|
||||||
err_mclk:
|
err_mclk:
|
||||||
clk_put(mclk);
|
clk_put(mclk);
|
||||||
mclk = NULL;
|
mclk = NULL;
|
||||||
|
|
Loading…
Add table
Reference in a new issue