ASoC: fsl_ssi: Use devm_snd_soc_register_component()
authorFabio Estevam <fabio.estevam@freescale.com>
Thu, 9 Apr 2015 17:56:41 +0000 (14:56 -0300)
committerMark Brown <broonie@kernel.org>
Fri, 10 Apr 2015 10:05:25 +0000 (11:05 +0100)
Using devm_snd_soc_register_component() can make the code shorter and
cleaner.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Acked-by: Nicolin Chen <nicoleotsuka@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/fsl/fsl_ssi.c

index 2595611e8a6ded3876345767bde2ce51e079c9ee..4201bfe2e9b9e4240a6d203e7e3bd34798bc7869 100644 (file)
@@ -1390,8 +1390,8 @@ static int fsl_ssi_probe(struct platform_device *pdev)
                        return ret;
        }
 
-       ret = snd_soc_register_component(&pdev->dev, &fsl_ssi_component,
-                                        &ssi_private->cpu_dai_drv, 1);
+       ret = devm_snd_soc_register_component(&pdev->dev, &fsl_ssi_component,
+                                             &ssi_private->cpu_dai_drv, 1);
        if (ret) {
                dev_err(&pdev->dev, "failed to register DAI: %d\n", ret);
                goto error_asoc_register;
@@ -1404,13 +1404,13 @@ static int fsl_ssi_probe(struct platform_device *pdev)
                if (ret < 0) {
                        dev_err(&pdev->dev, "could not claim irq %u\n",
                                        ssi_private->irq);
-                       goto error_irq;
+                       goto error_asoc_register;
                }
        }
 
        ret = fsl_ssi_debugfs_create(&ssi_private->dbg_stats, &pdev->dev);
        if (ret)
-               goto error_irq;
+               goto error_asoc_register;
 
        /*
         * If codec-handle property is missing from SSI node, we assume
@@ -1451,9 +1451,6 @@ done:
 error_sound_card:
        fsl_ssi_debugfs_remove(&ssi_private->dbg_stats);
 
-error_irq:
-       snd_soc_unregister_component(&pdev->dev);
-
 error_asoc_register:
        if (ssi_private->soc->imx)
                fsl_ssi_imx_clean(pdev, ssi_private);
@@ -1469,7 +1466,6 @@ static int fsl_ssi_remove(struct platform_device *pdev)
 
        if (ssi_private->pdev)
                platform_device_unregister(ssi_private->pdev);
-       snd_soc_unregister_component(&pdev->dev);
 
        if (ssi_private->soc->imx)
                fsl_ssi_imx_clean(pdev, ssi_private);