Skip to content

Commit

Permalink
ASoC: sam9g20_wm8731: fix resource leak in at91sam9g20ek_init error path
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Axel Lin authored and Mark Brown committed Nov 25, 2010
1 parent b193dee commit c7a734e
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion sound/soc/atmel/sam9g20_wm8731.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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;
Expand Down

0 comments on commit c7a734e

Please sign in to comment.