ASoC: mxs-saif: Use devm_clk_get()
authorFabio Estevam <fabio.estevam@freescale.com>
Tue, 7 Aug 2012 04:29:43 +0000 (01:29 -0300)
committerMark Brown <broonie@opensource.wolfsonmicro.com>
Tue, 7 Aug 2012 14:10:50 +0000 (15:10 +0100)
Using devm_clk_get can make the code simpler and smaller.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
sound/soc/mxs/mxs-saif.c

index b3030718c2288b9942628c9f087694b0568cbbb3..aa037b292f3dc05a9b6300c3cc4890988c0c2faf 100644 (file)
@@ -704,7 +704,7 @@ static int __devinit mxs_saif_probe(struct platform_device *pdev)
                return ret;
        }
 
-       saif->clk = clk_get(&pdev->dev, NULL);
+       saif->clk = devm_clk_get(&pdev->dev, NULL);
        if (IS_ERR(saif->clk)) {
                ret = PTR_ERR(saif->clk);
                dev_err(&pdev->dev, "Cannot get the clock: %d\n",
@@ -717,8 +717,7 @@ static int __devinit mxs_saif_probe(struct platform_device *pdev)
        saif->base = devm_request_and_ioremap(&pdev->dev, iores);
        if (!saif->base) {
                dev_err(&pdev->dev, "ioremap failed\n");
-               ret = -ENODEV;
-               goto failed_get_resource;
+               return -ENODEV;
        }
 
        dmares = platform_get_resource(pdev, IORESOURCE_DMA, 0);
@@ -731,7 +730,7 @@ static int __devinit mxs_saif_probe(struct platform_device *pdev)
                                           &saif->dma_param.chan_num);
                if (ret) {
                        dev_err(&pdev->dev, "failed to get dma channel\n");
-                       goto failed_get_resource;
+                       return ret;
                }
        } else {
                saif->dma_param.chan_num = dmares->start;
@@ -742,7 +741,7 @@ static int __devinit mxs_saif_probe(struct platform_device *pdev)
                ret = saif->irq;
                dev_err(&pdev->dev, "failed to get irq resource: %d\n",
                        ret);
-               goto failed_get_resource;
+               return ret;
        }
 
        saif->dev = &pdev->dev;
@@ -750,7 +749,7 @@ static int __devinit mxs_saif_probe(struct platform_device *pdev)
                               "mxs-saif", saif);
        if (ret) {
                dev_err(&pdev->dev, "failed to request irq\n");
-               goto failed_get_resource;
+               return ret;
        }
 
        saif->dma_param.chan_irq = platform_get_irq(pdev, 1);
@@ -758,7 +757,7 @@ static int __devinit mxs_saif_probe(struct platform_device *pdev)
                ret = saif->dma_param.chan_irq;
                dev_err(&pdev->dev, "failed to get dma irq resource: %d\n",
                        ret);
-               goto failed_get_resource;
+               return ret;
        }
 
        platform_set_drvdata(pdev, saif);
@@ -766,7 +765,7 @@ static int __devinit mxs_saif_probe(struct platform_device *pdev)
        ret = snd_soc_register_dai(&pdev->dev, &mxs_saif_dai);
        if (ret) {
                dev_err(&pdev->dev, "register DAI failed\n");
-               goto failed_get_resource;
+               return ret;
        }
 
        ret = mxs_pcm_platform_register(&pdev->dev);
@@ -779,19 +778,14 @@ static int __devinit mxs_saif_probe(struct platform_device *pdev)
 
 failed_pdev_alloc:
        snd_soc_unregister_dai(&pdev->dev);
-failed_get_resource:
-       clk_put(saif->clk);
 
        return ret;
 }
 
 static int __devexit mxs_saif_remove(struct platform_device *pdev)
 {
-       struct mxs_saif *saif = platform_get_drvdata(pdev);
-
        mxs_pcm_platform_unregister(&pdev->dev);
        snd_soc_unregister_dai(&pdev->dev);
-       clk_put(saif->clk);
 
        return 0;
 }
This page took 0.032516 seconds and 5 git commands to generate.