Skip to content

Commit

Permalink
ASoC: Fix resource reclaim for osk5912
Browse files Browse the repository at this point in the history
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: Axel Lin <[email protected]>
Acked-by: Jarkko Nikula <[email protected]>
Acked-by: Liam Girdwood <[email protected]>
Signed-off-by: Mark Brown <[email protected]>
  • Loading branch information
AxelLin authored and broonie committed Nov 25, 2010
1 parent fe99b55 commit 2543618
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions sound/soc/omap/osk5912.c
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,8 @@ static int __init osk_soc_init(void)
tlv320aic23_mclk = clk_get(dev, "mclk");
if (IS_ERR(tlv320aic23_mclk)) {
printk(KERN_ERR "Could not get mclk clock\n");
return -ENODEV;
err = PTR_ERR(tlv320aic23_mclk);
goto err2;
}

/*
Expand All @@ -188,17 +189,20 @@ static int __init osk_soc_init(void)
if (clk_set_rate(tlv320aic23_mclk, CODEC_CLOCK)) {
printk(KERN_ERR "Cannot set MCLK for AIC23 CODEC\n");
err = -ECANCELED;
goto err1;
goto err3;
}
}

printk(KERN_INFO "MCLK = %d [%d]\n",
(uint) clk_get_rate(tlv320aic23_mclk), CODEC_CLOCK);

return 0;
err1:

err3:
clk_put(tlv320aic23_mclk);
err2:
platform_device_del(osk_snd_device);
err1:
platform_device_put(osk_snd_device);

return err;
Expand All @@ -207,6 +211,7 @@ static int __init osk_soc_init(void)

static void __exit osk_soc_exit(void)
{
clk_put(tlv320aic23_mclk);
platform_device_unregister(osk_snd_device);
}

Expand Down

0 comments on commit 2543618

Please sign in to comment.