Commit 25436180 authored by Axel Lin's avatar Axel Lin Committed by Mark Brown

ASoC: Fix resource reclaim for osk5912

In current implementation, there are resources leak in the error path.
This patch properly reclaims the allocated resources in the error path.

Also adds a missing clk_put in osk_soc_exit.
Signed-off-by: default avatarAxel Lin <axel.lin@gmail.com>
Acked-by: default avatarJarkko Nikula <jhnikula@gmail.com>
Acked-by: default avatarLiam Girdwood <lrg@slimlogic.co.uk>
Signed-off-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
parent fe99b559
...@@ -177,7 +177,8 @@ static int __init osk_soc_init(void) ...@@ -177,7 +177,8 @@ static int __init osk_soc_init(void)
tlv320aic23_mclk = clk_get(dev, "mclk"); tlv320aic23_mclk = clk_get(dev, "mclk");
if (IS_ERR(tlv320aic23_mclk)) { if (IS_ERR(tlv320aic23_mclk)) {
printk(KERN_ERR "Could not get mclk clock\n"); printk(KERN_ERR "Could not get mclk clock\n");
return -ENODEV; err = PTR_ERR(tlv320aic23_mclk);
goto err2;
} }
/* /*
...@@ -188,7 +189,7 @@ static int __init osk_soc_init(void) ...@@ -188,7 +189,7 @@ static int __init osk_soc_init(void)
if (clk_set_rate(tlv320aic23_mclk, CODEC_CLOCK)) { if (clk_set_rate(tlv320aic23_mclk, CODEC_CLOCK)) {
printk(KERN_ERR "Cannot set MCLK for AIC23 CODEC\n"); printk(KERN_ERR "Cannot set MCLK for AIC23 CODEC\n");
err = -ECANCELED; err = -ECANCELED;
goto err1; goto err3;
} }
} }
...@@ -196,9 +197,12 @@ static int __init osk_soc_init(void) ...@@ -196,9 +197,12 @@ static int __init osk_soc_init(void)
(uint) clk_get_rate(tlv320aic23_mclk), CODEC_CLOCK); (uint) clk_get_rate(tlv320aic23_mclk), CODEC_CLOCK);
return 0; return 0;
err1:
err3:
clk_put(tlv320aic23_mclk); clk_put(tlv320aic23_mclk);
err2:
platform_device_del(osk_snd_device); platform_device_del(osk_snd_device);
err1:
platform_device_put(osk_snd_device); platform_device_put(osk_snd_device);
return err; return err;
...@@ -207,6 +211,7 @@ static int __init osk_soc_init(void) ...@@ -207,6 +211,7 @@ static int __init osk_soc_init(void)
static void __exit osk_soc_exit(void) static void __exit osk_soc_exit(void)
{ {
clk_put(tlv320aic23_mclk);
platform_device_unregister(osk_snd_device); platform_device_unregister(osk_snd_device);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment