Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6
[pandora-kernel.git] / sound / soc / samsung / smdk_spdif.c
index cd29da0..b5c3fad 100644 (file)
@@ -28,7 +28,7 @@
 static int set_audio_clock_heirachy(struct platform_device *pdev)
 {
        struct clk *fout_epll, *mout_epll, *sclk_audio0, *sclk_spdif;
-       int ret;
+       int ret = 0;
 
        fout_epll = clk_get(NULL, "fout_epll");
        if (IS_ERR(fout_epll)) {
@@ -61,7 +61,7 @@ static int set_audio_clock_heirachy(struct platform_device *pdev)
                goto out3;
        }
 
-       /* Set audio clock heirachy for S/PDIF */
+       /* Set audio clock hierarchy for S/PDIF */
        clk_set_parent(mout_epll, fout_epll);
        clk_set_parent(sclk_audio0, mout_epll);
        clk_set_parent(sclk_spdif, sclk_audio0);
@@ -79,7 +79,7 @@ out1:
 
 /* We should haved to set clock directly on this part because of clock
  * scheme of Samsudng SoCs did not support to set rates from abstrct
- * clock of it's heirachy.
+ * clock of it's hierarchy.
  */
 static int set_audio_clock_rate(unsigned long epll_rate,
                                unsigned long audio_rate)
@@ -152,8 +152,6 @@ static struct snd_soc_ops smdk_spdif_ops = {
        .hw_params = smdk_hw_params,
 };
 
-static struct snd_soc_card smdk;
-
 static struct snd_soc_dai_link smdk_dai = {
        .name = "S/PDIF",
        .stream_name = "S/PDIF PCM Playback",
@@ -183,7 +181,7 @@ static int __init smdk_init(void)
 
        ret = platform_device_add(smdk_snd_spdif_dit_device);
        if (ret)
-               goto err2;
+               goto err1;
 
        smdk_snd_spdif_device = platform_device_alloc("soc-audio", -1);
        if (!smdk_snd_spdif_device) {
@@ -195,17 +193,21 @@ static int __init smdk_init(void)
 
        ret = platform_device_add(smdk_snd_spdif_device);
        if (ret)
-               goto err1;
+               goto err3;
 
-       /* Set audio clock heirachy manually */
+       /* Set audio clock hierarchy manually */
        ret = set_audio_clock_heirachy(smdk_snd_spdif_device);
        if (ret)
-               goto err1;
+               goto err4;
 
        return 0;
-err1:
+err4:
+       platform_device_del(smdk_snd_spdif_device);
+err3:
        platform_device_put(smdk_snd_spdif_device);
 err2:
+       platform_device_del(smdk_snd_spdif_dit_device);
+err1:
        platform_device_put(smdk_snd_spdif_dit_device);
        return ret;
 }
@@ -213,6 +215,7 @@ err2:
 static void __exit smdk_exit(void)
 {
        platform_device_unregister(smdk_snd_spdif_device);
+       platform_device_unregister(smdk_snd_spdif_dit_device);
 }
 
 module_init(smdk_init);