ASoC: fsl_spdif: Use devm_snd_soc_register_component

devm_snd_soc_register_component makes code simpler.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Mark Brown <broonie@linaro.org>
This commit is contained in:
Sachin Kamat 2013-09-17 10:13:49 +05:30 committed by Mark Brown
parent 67a48b8181
commit 256218ae65

View file

@ -1172,23 +1172,16 @@ static int fsl_spdif_probe(struct platform_device *pdev)
/* Register with ASoC */ /* Register with ASoC */
dev_set_drvdata(&pdev->dev, spdif_priv); dev_set_drvdata(&pdev->dev, spdif_priv);
ret = snd_soc_register_component(&pdev->dev, &fsl_spdif_component, ret = devm_snd_soc_register_component(&pdev->dev, &fsl_spdif_component,
&spdif_priv->cpu_dai_drv, 1); &spdif_priv->cpu_dai_drv, 1);
if (ret) { if (ret) {
dev_err(&pdev->dev, "failed to register DAI: %d\n", ret); dev_err(&pdev->dev, "failed to register DAI: %d\n", ret);
return ret; return ret;
} }
ret = imx_pcm_dma_init(pdev); ret = imx_pcm_dma_init(pdev);
if (ret) { if (ret)
dev_err(&pdev->dev, "imx_pcm_dma_init failed: %d\n", ret); dev_err(&pdev->dev, "imx_pcm_dma_init failed: %d\n", ret);
goto error_component;
}
return ret;
error_component:
snd_soc_unregister_component(&pdev->dev);
return ret; return ret;
} }
@ -1196,7 +1189,6 @@ static int fsl_spdif_probe(struct platform_device *pdev)
static int fsl_spdif_remove(struct platform_device *pdev) static int fsl_spdif_remove(struct platform_device *pdev)
{ {
imx_pcm_dma_exit(pdev); imx_pcm_dma_exit(pdev);
snd_soc_unregister_component(&pdev->dev);
return 0; return 0;
} }